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

Marker comparisons silently switches from version comparison to lexicographically #633

Open
konstin opened this issue Dec 8, 2022 · 0 comments

Comments

@konstin
Copy link

konstin commented Dec 8, 2022

Marker comparisons silently switch from version number comparison to stringly, lexicographical comparison, e.g. on python 3.10 and packaging 22.0:

>>> from packaging.requirements import Requirement
>>> Requirement('numpy; python_version >= "3.9."').marker.evaluate()
False
>>> Requirement('numpy; python_version >= "3.9"').marker.evaluate()
True

I'm not aware of any case where that behavior is intended and PEP 508 is fuzzy about this, so i'd propose to print a warning whenever one of the version_cmp operators gets used without valid PEP 440 versions, and amend PEP 508 / Dependency specifiers with that.

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

2 participants