-
Notifications
You must be signed in to change notification settings - Fork 251
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
Resolve invalid python version constraint #154
Resolve invalid python version constraint #154
Conversation
I don't think it's invalid. See python-poetry/poetry#3862 (comment) and the following comment. |
tests/packages/test_main.py
Outdated
|
||
assert dep.name == "pytest-mypy" | ||
assert str(dep.constraint) == "*" | ||
assert dep.python_versions == "<3.10 >=4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on https://www.python.org/dev/peps/pep-0508/#versions and https://www.python.org/dev/peps/pep-0508/#environment-markers, I'd say Poetry should not consider > "3"
to be equivalent to >= "4"
. These versions should be compared using PEP440, and with PEP440 3.6
is greater than 3
, so the range specified in the mentioned marker is valid.
>>> import packaging
>>> from packaging import version
>>> version.parse("3.6") > version.parse("3")
True
>>> version.parse("3.6") >= version.parse("4")
False
Anyway, your changes are still important for other invalid markers 👍 |
5167dd4
to
e414556
Compare
I have updated the tests for 'real' invalid constraint such as |
Oops, it seems like the test case with |
I cannot come up with a python version constraint that produces |
Resolves: python-poetry#
backports.functools_lru_cache
has following dependency insetup.cfg
(https://github.com/jaraco/backports.functools_lru_cache/blob/74120920aa77047323b7ca25533f57bdae4ead1c/setup.cfg#L48):It has a python version constraint of<3.10 >3
and it seems invalid. And it breaks poetry. Related issue: python-poetry/poetry#534The constraint mentioned above was not actually invalid. That case was resolved in #155.
This PR makes poetry can resolve dependencies with the broken constraints, such as
python_version >= "3.6" and python_version <= "3.4"