question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Breaking change in handling of some version constraints from `poetry-core` `1.0.0` to `1.1.0`

See original GitHub issue
  • 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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
dimblebycommented, Sep 14, 2022

though fwiw >=0.32b0,<0.32 is not unsolvable: it allows 0.32b0 (and 0.32b1, etc)

0reactions
dimblebycommented, Sep 19, 2022

yep, I think we’re all on the same page now.

If you can get https://github.com/python-poetry/poetry-core/pull/475 over the line everything should be good

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry skipping dependencies with both lower and upper ...
Seems to me like a comma , is missing to delimit the parts of the version specifiers of A 's dependencies. For example...
Read more >
History | Poetry - Python dependency management and ...
Important: This release fixes a critical issue that prevented hashes from being retrieved when locking dependencies, due to a breaking change on PyPI...
Read more >
Dependency Management With Python Poetry
Learn how Python Poetry will help you start new projects, maintain existing ones, and master dependency management.
Read more >
poetry Changelog - pyup.io
- `ParseConstraintError` is now raised on version and constraint parsing errors, and includes information on the package that caused the error ([514](https:// ...
Read more >
History - GINO 1.1.0b2 documentation
1.0.0 (2020-04-26)¶. Switched to Poetry for package and dependency management. [Breaking] Moved built-in extension modules to separate PyPI packages ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found