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

Version parsing error in packaging 22.0 #651

Closed
WillChen789 opened this issue Dec 29, 2022 · 3 comments
Closed

Version parsing error in packaging 22.0 #651

WillChen789 opened this issue Dec 29, 2022 · 3 comments

Comments

@WillChen789
Copy link

Hello, I recently observed some unexpected behavior with packaging 22.0 where version.parse will throw an exception when multiple comma-separated version numbers are provided to the function.

To repro:

from packaging.version import parse
print(parse('0.10.1,<0.11'))

Executing this with packaging 21.3 will return the expected output:

0.10.1,<0.11

Whereas executing this with packaging 22.0 will throw an InvalidVersion exception:

InvalidVersion: Invalid version: '0.10.1,

Was this an intended change? For context, please see transformers for a live example where this is relevant: https://github.com/huggingface/transformers/blob/main/src/transformers/dependency_versions_table.py

Thank you for your attention regarding this issue.

@uranusjr
Copy link
Member

uranusjr commented Dec 29, 2022

The string you provide is indeed invalid, not raising an exception is a bug. I’d say this is a good fix.

@pradyunsg
Copy link
Member

pradyunsg commented Dec 29, 2022

This is intentional, and explicitly rejecting a string that is not a version (in packaging.version.parse) is indeed an intended change.

@pradyunsg
Copy link
Member

See #321 and #530 for the details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants