#python #poetry #dependency resolution #issue...

Went to upgrade a dependency in a poetry-managed project today, and it's failing resolution with what looks like nonsense as reasons. Tried with 1.8.x, then tried with the just-released 2.0. Both fail for what look like the same reasons.

My project has the Python version and another dep declared:

python = ">=3.10"
yacv-server = "*"

When resolving, it produces this error:

The current project's supported Python range (>=3.10) is not compatible with some of the required
packages Python requirement:
- yacv-server requires Python <3.13,>=3.9, so it will not be satisfied for Python >=3.13
- yacv-server requires Python <4.0,>=3.9, so it will not be satisfied for Python >=4.0
- yacv-server requires Python >=3.9,<4.0, so it will not be satisfied for Python >=4.0
[...]

It outputs one of the latter errors for each released version of yacv-server. Half list the required Python as ">=3.9,<4.0" and the other half have it in reverse order, "<4.0,>=3.9". Then the later explanation section of the output has:

[...]
So, because yacv-server (0.9.3) requires Python <3.13,>=3.9
and cq-studio depends on yacv-server (*), version solving failed.

• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

For yacv-server, a possible solution would be to set the `python` property to ">=3.10,<3.13"
[...]

Why it thinks 3.10 isn't >=3.9?

@cazabon I don't know but if any dep sets a maximum python, then your app must as well, when using poetry. Asottile has a video arguing that this is a bad idea to set a maximum, both on library maintainers' part and on poetry's part.

@mistersql

This was exactly the problem; thank you! I don't know how I haven't run into this problem before. Must be because I manually changed the Python dep for this project from poetry's default `^3.<minor>` to `>=3.10` specifically to avoid pinning the minor version.

This is definitely an unexpected sharp edge with poetry - particularly considering the diagnostic it gives doesn't even hint as to what the true problem is.

#solution #problem #SharpEdge #debug #debugging #PythonPoetry