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

ignore trailing commas in versions #15

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

matt-phylum
Copy link
Contributor

The documentation says that the current behavior is correct, but the canonical implementation of the documentation accepts trailing commas, and this has been observed in packages.

See pypa/packaging#803 for details.

>>> from packaging.requirements import Requirement
>>>
>>> print(Requirement("numpy >=1.19, "))
numpy>=1.19

@konstin
Copy link
Owner

konstin commented May 21, 2024

Sorry, but i won't accept non-spec extensions for the grammar. If you need to accept invalid versions specifiers (there's a lot of them on pypi historically), consider adding preprocessing (https://github.com/astral-sh/uv/blob/55f6e4e66bb67c6928437f4c6a791c9fc3409d3b/crates/pypi-types/src/lenient_requirement.rs).

@konstin konstin closed this May 21, 2024
@matt-phylum
Copy link
Contributor Author

The spec has been updated so this should be reopened: https://packaging.python.org/en/latest/specifications/dependency-specifiers/#history

@konstin konstin reopened this Jun 27, 2024
@konstin konstin merged commit c1274b1 into konstin:main Jun 27, 2024
3 checks passed
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