Breaking change in handling of some version constraints from poetry-core
1.0.0
to 1.1.0
#6519
Description
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: Mac OS X 11.6 (BigSur)
- Poetry version: 1.1.14 -> 1.2.0
- Link of a Gist with the contents of your pyproject.toml file:
Issue
I ran into an interesting bug (I'm not sure if it's the root cause of some other issues, I had trouble finding a matching issue) where when poetry was using poetry-core==1.0.0
it was correctly resolving the version constraint of a somewhat non-standard semver version, but once poetry started using version poetry-core==1.1.0
, it's no longer correctly resolving the same version constraint, resulting in dependency resolution issues because the resolved constraint is never satisfiable.
For more context, in my current project, I'm pulling in a library:
opentelemetry-instrumentation-fastapi = "^0.32b0"
Where the next available version is 0.33b0
.
In a version of poetry that uses poetry-core==1.0.0
, it correctly resolves this constraint:
# pip install poetry-core==1.0.0
# python <<EOF
from poetry.core.semver import parse_constraint
print(parse_constraint("^0.32b0"))
EOF
This will output >=0.32b0,<0.33
, which is what ultimately ends up in setup.py
when publishing with poetry.
Now, using poetry-core==1.1.0
:
# pip install poetry-core==1.1.0
# python <<EOF
from poetry.core.semver.version import Version
print(Version.parse("0.32b0").next_breaking())
EOF
This will output 0.32
, which ultimately will get translated to a constraint that's unsolvable >=0.32b0,<0.32
in setup.py
:
install_requires = \
['fastapi-versioning>=0.10.0,<0.11.0',
'fastapi>=0.79.0,<0.80.0',
'gprof2dot>=2022.7.29,<2023.0.0',
'opentelemetry-instrumentation-fastapi>=0.32b0,<0.32', # <-- here
'opentelemetry-instrumentation-logging>=0.32b0,<0.32', # <-- and here
'requests>=2.27.1,<3.0.0',
'splunk-opentelemetry[all]>=1.7.0,<2.0.0',
'starlette-exporter>=0.14.0,<0.15.0',
'uvicorn[standard]>=0.18.2,<0.19.0']
Ultimately, after upgrading to poetry
version 1.2.0
and publishing my package, it could no longer be installed because this version constraint could no longer be satisfied, resulting in a breaking change. I've worked around this for now by specifying an explicit version constraint, but, wanted to see if this is something that anyone else has noticed, if this is a "won't fix" type situation, since the version is somewhat non-standard, etc.