We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Fairly easy to recreate
from packaging import specifiers # this returns False specifiers.SpecifierSet("~=2022.01.01").contains("2022.01.01")
Seems when passing the raw string the parse function is reducing the comparison version to 2022.1.1 which never matches ~=2022.01.01.
parse
2022.1.1
~=2022.01.01
My workaround is to always parse the version and use version.base_version for the specifier
version.base_version
from packaging import specifiers, version spec_version = version.parse("2022.01.01") specifiers.SpecifierSet(f"~={spec_version.base_version}").contains("2022.01.01")
The text was updated successfully, but these errors were encountered:
Can you reproduce this with the current main branch of this repository?
main
pip install git+https://github.com/pypa/packaging
Sorry, something went wrong.
Yup
In [3]: from packaging import specifiers ...: ...: # this returns False ...: specifiers.SpecifierSet("~=2022.01.01").contains("2022.01.01") ...: Out[3]: False In [4]: import packaging In [5]: packaging.__version__ Out[5]: '21.4.dev0'
Python 3.8.13 on arm64 macos
I believe this is the same as #561; ~= {version} simply delegates everything to == {version}.*.
~= {version}
== {version}.*
Successfully merging a pull request may close this issue.
Fairly easy to recreate
Seems when passing the raw string the
parse
function is reducing the comparison version to2022.1.1
which never matches~=2022.01.01
.My workaround is to always parse the version and use
version.base_version
for the specifierThe text was updated successfully, but these errors were encountered: