-
Notifications
You must be signed in to change notification settings - Fork 248
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
Compatible version specifier merge incorrectly strip trailing "0" components #421
Comments
Any update so far? |
If there were any, they would've been posted on this issue. If you're interested in seeing this get resolved, a PR fixing this would be welcome. |
@pradyunsg thanks for the info. I'll take a look if I might can provide a PR |
So as far as I understand that, the following code should return always the more strict version, right? from packaging.specifiers import SpecifierSet
SpecifierSet("~=1.18") & SpecifierSet("~=1.18.0") Returns Currently, it returns the specs of the left side. Therefore my question, is there already a function which returns the more strict version? If not, would the Specifier class the right place? See https://github.com/pypa/packaging/blob/main/packaging/specifiers.py#L667 |
You don’t really need such a function (logically; cosmetic is another issue). A SpecifierSet is the sum of its parts, so instead of returning So the solution would be to fix |
Great, thanks! |
Can you please release a new version with the fix? |
This is wrong. According to PEP 440:
~=1.18.0
means>=1.18.0, ==1.18.*
~=1.18
means>=1.18, ==1.*
So merging them should give
>=1.18, >=1.18.0, ==1.*, ==1.18.*
>=1.18, ==1.*, ==1.18.*
>=1.18, ==1.18.*
← This is where packaging currently gets wrong.i.e.
~=1.18.0
.Originally reported in pypa/pip#9613.
The text was updated successfully, but these errors were encountered: