Resolve invalid python version constraint#154
Resolve invalid python version constraint#154pbzweihander wants to merge 1 commit intopython-poetry:masterfrom
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.
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_cachehas 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 >3and 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"