-
Notifications
You must be signed in to change notification settings - Fork 250
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
Using .*
with operators other than ==
and !=
#645
Comments
I believe this is intended. Wildcard cannot be used with This has caused much confusion I wonder if we should extend the spec a bit to allow |
This isn't a bug per se, but an intentional change. I do wonder if a slightly nicer error message is a better strategy here, long term than relaxing the syntax to silently ignore part of the input. |
I think failing to process stars is a good thing. Stars are evil. :) |
Looks like this snared a (I think this is a good change! But it looks like there are some packages on PyPI that use |
FWIW, the functionality that allowed this is also the functionality that considered the following to be a valid requirement.
|
We follow `pip`'s lead here and ignore these entirely, treating them as if they don't exist (while also warning the user). Fixes #445. See: pypa/packaging#645 Signed-off-by: William Woodruff <[email protected]>
* pip_audit, test: handle invalid requires-python specifiers We follow `pip`'s lead here and ignore these entirely, treating them as if they don't exist (while also warning the user). Fixes #445. See: pypa/packaging#645 Signed-off-by: William Woodruff <[email protected]> * CHANGELOG: record changes Signed-off-by: William Woodruff <[email protected]> Signed-off-by: William Woodruff <[email protected]>
.*
with operators other than ==
and !=
#662 adds the better error messaging I mentioned in #645 (comment). |
Strictly speaking, I don't think this is true when pre-releases are considered:
I personally have used this wildcard form to say "any version less than the next major one, including that version's release candidates", namely I didn't see this before now, and I am only aware that the specifier was wrong due to the recent setuptools release (issue). |
The example you gave ( |
>>> from packaging.version import Version
>>> from packaging.specifiers import SpecifierSet
>>> Version("3.1") in SpecifierSet("<= 3")
False No, it's not -- |
I will note that "less than" with >>> import packaging
>>> packaging.__version__
'21.3'
>>> from packaging.version import Version
>>> from packaging.specifiers import SpecifierSet
>>> Version("3.1") in SpecifierSet("<= 3.*")
False |
FWIW, Paul Moore also made this point in https://discuss.python.org/t/should-we-permit-with-more-comparision-operators-in-version-specifiers/22782/10?u=pradyunsg At this point, instead of having this discussion in two places, I'll request that folks direct any future comments to that thread. To that end, I'm gonna close this out, to reflect that the discussion on what to do for these cases should happen over there and not here. |
The old versioning scheme made it difficult to write useful version requirements, since e.g. `yowasp-yosys>=0.20` excludes pre-releases. Before pypa/packaging#645, `yowasp-yosys>=0.20.*` happened to work by accident, but this is no longer the case and specifying such a requirement in `pyproject.toml` is not possible anyway. All versions using the new scheme are strictly greater (even for old commits), so this should not cause any confusion.
The old versioning scheme made it difficult to write useful version requirements, since e.g. `yowasp-yosys>=0.20` excludes pre-releases. Before pypa/packaging#645, `yowasp-yosys>=0.20.*` happened to work by accident, but this is no longer the case and specifying such a requirement in `pyproject.toml` is not possible anyway. All versions using the new scheme are strictly greater (even for old commits), so this should not cause any confusion.
The old versioning scheme made it difficult to write useful version requirements, since e.g. `yowasp-yosys>=0.20` excludes pre-releases. Before pypa/packaging#645, `yowasp-yosys>=0.20.*` happened to work by accident, but this is no longer the case and specifying such a requirement in `pyproject.toml` is not possible anyway. All versions using the new scheme are strictly greater (even for old commits), so this should not cause any confusion.
wildcard specifiers such as `cloudpickle>=1.6.*` are invalid since packaging 22.0, see also discussion at pypa/packaging#645
* pip_audit, test: handle invalid requires-python specifiers We follow `pip`'s lead here and ignore these entirely, treating them as if they don't exist (while also warning the user). Fixes #445. See: pypa/packaging#645 Signed-off-by: William Woodruff <[email protected]> * CHANGELOG: record changes Signed-off-by: William Woodruff <[email protected]> Signed-off-by: William Woodruff <[email protected]>
* pip_audit, test: handle invalid requires-python specifiers We follow `pip`'s lead here and ignore these entirely, treating them as if they don't exist (while also warning the user). Fixes #445. See: pypa/packaging#645 Signed-off-by: William Woodruff <[email protected]> * CHANGELOG: record changes Signed-off-by: William Woodruff <[email protected]> Signed-off-by: William Woodruff <[email protected]>
In packaging 21.3 having a wildcard in the install_requires section of a setup.py worked fine.
Example:
In version 22.0 it throws this error:
The text was updated successfully, but these errors were encountered: