Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eleven-months-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/python": patch
---

Fixed the bug where you can only specify the requirements file as top level
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Polish changelog phrasing (“top‑level”)

Tighten wording and fix the hyphenation.

-Fixed the bug where you can only specify the requirements file as top level
+Fixed a bug that required the requirements file to be top‑level; nested paths are now supported.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Fixed the bug where you can only specify the requirements file as top level
Fixed a bug that required the requirements file to be top-level; nested paths are now supported.
🤖 Prompt for AI Agents
In .changeset/eleven-months-brake.md around line 5, update the changelog
sentence to tighten wording and use the hyphenated term "top‑level"; replace the
current line ("Fixed the bug where you can only specify the requirements file as
top level") with a clearer phrase such as "Fixed the bug where the requirements
file could only be specified at the top‑level." Ensure the hyphenation is the
non‑breaking hyphen (top‑level) and adjust punctuation to match the file's
style.

2 changes: 1 addition & 1 deletion packages/python/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class PythonExtension implements BuildExtension {
image: {
instructions: splitAndCleanComments(`
# Copy the requirements file
COPY ${this.options.requirementsFile} .
COPY ${this.options.requirementsFile} ${this.options.requirementsFile}
# Install dependencies
RUN pip install --no-cache-dir -r ${this.options.requirementsFile}
Comment on lines +124 to 126
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use JSON-array COPY and quote the pip path; normalize for Windows backslashes

Prevents failures when the requirements path contains spaces or backslashes and makes COPY unambiguous.

-            COPY ${this.options.requirementsFile} ${this.options.requirementsFile}
+            COPY ["${this.options.requirementsFile.replace(/\\\\/g, "/")}", "${this.options.requirementsFile.replace(/\\\\/g, "/")}"]
             # Install dependencies
-            RUN pip install --no-cache-dir -r ${this.options.requirementsFile}
+            RUN pip install --no-cache-dir -r "${this.options.requirementsFile.replace(/\\\\/g, "/")}"

If you prefer readability, precompute the normalized path once and reuse it:

// above, before context.addLayer(...)
const reqFile = this.options.requirementsFile!.replace(/\\/g, "/");

and then:

-            COPY ["${this.options.requirementsFile.replace(/\\\\/g, "/")}", "${this.options.requirementsFile.replace(/\\\\/g, "/")}"]
+            COPY ["${reqFile}", "${reqFile}"]
-            RUN pip install --no-cache-dir -r "${this.options.requirementsFile.replace(/\\\\/g, "/")}"
+            RUN pip install --no-cache-dir -r "${reqFile}"
🤖 Prompt for AI Agents
In packages/python/src/extension.ts around lines 124 to 126, the Dockerfile COPY
and RUN lines can break when requirementsFile contains spaces or Windows
backslashes; normalize the path (replace backslashes with "/") once into a
variable (e.g. reqFile) and then use the JSON-array form for COPY and quote the
pip path in RUN so the COPY is unambiguous and pip receives a quoted, normalized
path (i.e., use COPY ["<reqFile>","<reqFile>"] and RUN pip install
--no-cache-dir -r "<reqFile>").

`),
Expand Down