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

feat(pypi) Handle local version in requirement parsing #2377

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ewianda
Copy link
Contributor

@ewianda ewianda commented Nov 6, 2024

This change makes it possible to handle local versions of packages, especially pytorch. With this change, it is possible to have different versions of the same package

@ewianda ewianda force-pushed the feat-pip-parse-handle-local-versions branch 3 times, most recently from 69fd075 to 3e05fbf Compare November 15, 2024 18:02
@ewianda ewianda force-pushed the feat-pip-parse-handle-local-versions branch from 3e05fbf to 3002d39 Compare November 15, 2024 18:20
@ewianda ewianda marked this pull request as ready for review November 15, 2024 21:13
Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

Does this fix the #2337 issue? Looking at the fix here this may be the case, but I am not sure.

version_start = entry.find("==")
if version_start != -1:
# Extract everything after '==' until the next space or end of the string
version = entry[version_start + 2:].split(" ")[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I prefer using partition in the code because it just creates three return values.

Suggested change
version = entry[version_start + 2:].split(" ")[0]
version, _, _ = entry[version_start + 2:].partition(" ")

Comment on lines +38 to +39

entry: The requirement string.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
entry: The requirement string.
Args:
entry: {type}`str` The requirement string.

Comment on lines -95 to +108
normalize_name(entry[0]): entry
(entry[0], _extract_version(entry[1])): entry
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are dropping the normalize_name here, could we keep it here please?

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.

2 participants