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

bug: Specifier("==1.0.*") does not contain Version("1a1") #559

Closed
mayeut opened this issue Jun 18, 2022 · 1 comment · Fixed by #564
Closed

bug: Specifier("==1.0.*") does not contain Version("1a1") #559

mayeut opened this issue Jun 18, 2022 · 1 comment · Fixed by #564

Comments

@mayeut
Copy link
Member

mayeut commented Jun 18, 2022

This bug was initially reported in #425
In this specific instance, the meaning of the specifier is clear whereas it is not the case in the original description of #425.
This led me to open a specific issue for this one.

>>> from packaging import __version__
>>> print(__version__)
21.4.dev0
>>> from packaging.specifiers import Specifier
>>> from packaging.version import Version
>>> spec = Specifier("==1.0.*")
>>> version1 = Version("1a1")
>>> version2 = Version("1.0a1")
>>> version1 == version2
True
>>> spec.contains(version1, prereleases=True) == spec.contains(version2, prereleases=True)
False
@pfmoore
Copy link
Member

pfmoore commented Aug 15, 2022

I think this is another aspect of the same issue:

>>> Specifier(">=3.11").contains("3.11.0rc1", True)
False

It seems to me that if I ask for prereleases, I'd want 3.11.0rc1 to be considered as >=3.11. Although I'd happily concede that PEP 440 seems unclear on this.

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