-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Pre-release ~= constrains are mis calculated #1150
Copy link
Copy link
Closed
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 (
-vvvoption).
- OS version and name: Windows
- Poetry version: 0.12.16
- Link of a Gist with the contents of your pyproject.toml file: N/A, requires access to a proprietary pypi instance
Issue
My constraints aren't resolving.
A rough look at my dependency tree
- A: `B = "^0.7.5" via poetry
- B:
"C~=0.2.0dev16"via setup.py
Poetry complains that it cannot resolve B's dependency on C
[SolverProblemError]
Because B (0.7.5) depends on C(>=0.2.0,<0.3.0) which doesn't match any versions, B is forbidden.
So, because no versions of B match >0.7.5,<0.8.0
and A depends on B (^0.7.5), version solving failed.
I traced the problem down into semver/__init__.py:parse_single_constraint where the constraint
~=0.2.0dev16
gets compiled into>=0.2.0,<0.3.0
In contrast, the constraint
~=2.0.dev0
correctly gets compiled into>=2.0.dev0,<3.0.0
The problem seems to be
if precision == 2:
low = version
high = version.stable.next_major
else:
low = Version(version.major, version.minor, 0)
high = version.stable.next_minorwhere if the precision is 1 or 3, then the pre-release is dropped from low, disqualifying them from resolving the constraint.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels