Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix requirements parsing with index URL option #1251

Merged
merged 13 commits into from
Oct 11, 2023
Merged

Fix requirements parsing with index URL option #1251

merged 13 commits into from
Oct 11, 2023

Conversation

cd-work
Copy link
Contributor

@cd-work cd-work commented Oct 11, 2023

No description provided.

Copy link
Contributor

@maxrake maxrake left a comment

Choose a reason for hiding this comment

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

This round of changes was tested and appears to function as intended...but the understanding is that more changes are coming to better satisfy CLI and API...by accounting for these types of dependencies as third party.

CHANGELOG entry needed.

@cd-work cd-work marked this pull request as ready for review October 11, 2023 15:09
@cd-work cd-work requested a review from a team as a code owner October 11, 2023 15:09
@cd-work cd-work requested a review from maxrake October 11, 2023 15:09
@cd-work cd-work requested a review from kylewillmon October 11, 2023 15:24
kylewillmon
kylewillmon previously approved these changes Oct 11, 2023
Copy link
Contributor

@maxrake maxrake left a comment

Choose a reason for hiding this comment

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

The changes were tested and work for the specific test case provided, but alternate inputs result in failure.

lockfile/src/parsers/pypi.rs Outdated Show resolved Hide resolved
tests/fixtures/requirements-locked.txt Outdated Show resolved Hide resolved
lockfile/src/parsers/pypi.rs Outdated Show resolved Hide resolved
@cd-work cd-work requested a review from kylewillmon October 11, 2023 16:26
maxrake
maxrake previously approved these changes Oct 11, 2023
Copy link
Contributor

@maxrake maxrake left a comment

Choose a reason for hiding this comment

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

The changes were tested locally and appear to work as intended. There is still the possibility that a -f/--find-links option is included in the requirements file, which should similarly be treated as a third party dependency source. However, that case may be able to wait until it is clear that it causes issues for users.

CHANGELOG.md Outdated Show resolved Hide resolved
@kylewillmon kylewillmon requested a review from maxrake October 11, 2023 18:29
Copy link
Contributor

@maxrake maxrake left a comment

Choose a reason for hiding this comment

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

The changes were tested locally and work as intended.

@kylewillmon kylewillmon enabled auto-merge (squash) October 11, 2023 18:42
@kylewillmon kylewillmon merged commit 3a7ecb0 into main Oct 11, 2023
13 checks passed
@kylewillmon kylewillmon deleted the fix_piparser branch October 11, 2023 18:43
// primary one.
if let Some(index_url) = line
.strip_prefix("--index-url")
.and_then(|line| line.strip_prefix(['=', ' ']))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to make sure, I'd assume --index-url = https://whatever.com is not valid?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct...that form is not valid:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

There are other weird edge cases... But I don't want to waste a bunch of time on them...

> cat req.txt
--index-url https://pypi.org/simple AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

pyyaml

> pip install --dry-run -r req.txt
Collecting pyyaml
  Downloading PyYAML-6.0.1-cp310-cp310-macosx_11_0_arm64.whl (169 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 169.3/169.3 kB 2.1 MB/s eta 0:00:00
Would install PyYAML-6.0.1

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.

3 participants