Fix handling of markers when resolving #2342
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Check List
Resolves: #1238
Resolves: #1885
Resolves: #2008
Resolves: #2133
Resolves: #2329
This one was long overdue. The way we handled environment markers when resolving was sub optimal to say the least.
Here is what this PR actually does:
If "duplicated" dependencies are found with different environment markers, Poetry will relaunch the dependency resolution with specific dependency overrides to build separate dependency graphs. For instance:
slash==1.10.0
has the following dependencies:So, this will trigger two separate dependency resolutions:
{<Package slash-1.10.0>: {'ipython': <Dependency IPython (*)>}}
{<Package slash-1.10.0>: {'ipython': <Dependency IPython (1.2.1)>}}
A side effect of that is we will now have a more accurate lock file with less multiple version of a same package.
The only drawback to this change is speed: if there are multiple cases like this in the dependency graph, Poetry will need to start anew with new overrides each time which can drastically impact performances. That's why the use of multiple constraints dependencies should be used as a last resort because it makes the dependency resolution that much harder.