Skip to content

fix(apps): ignore inline comments in requirements.txt - #722

Open
irisfield wants to merge 1 commit into
runpod:mainfrom
irisfield:fix/flash-requirements-inline-comments
Open

irisfield wants to merge 1 commit into
runpod:mainfrom
irisfield:fix/flash-requirements-inline-comments

Conversation

@irisfield

Copy link
Copy Markdown

Fixes #721

Problem

rp flash deploy passes each requirements.txt line to the vendoring step unchanged unless the line starts with #, so a line such as requests==2.32.3 # http client is rejected as an invalid requirement.

Fix

_requirements_txt removes a comment before it keeps the line, using pip's rule: a # at the start of a line or after whitespace begins a comment. A # inside a URL, such as #sha256=..., is kept. This change does not touch -r handling.

Tests

One test in tests/test_apps/test_build.py, failing without this change: a line with an inline comment, a line with a tab before the comment, and a URL requirement with a #sha256= fragment that must be kept.

Before and after

requirements.txt containing requests==2.32.3 # http client, rp flash deploy --build-only:

2.1.0 With this change
result Error: dependency vendoring failed: ERROR: Invalid requirement: 'requests==2.32.3 # http client' builds, requests-2.32.3 is in the artifact

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rp flash deploy fails when requirements.txt has an inline comment

1 participant