Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of markers when resolving #2342

Merged
merged 2 commits into from
Apr 24, 2020

Conversation

sdispater
Copy link
Member

Pull Request Check List

Resolves: #1238
Resolves: #1885
Resolves: #2008
Resolves: #2133
Resolves: #2329

  • Added tests for changed code.
  • Updated documentation for changed code.

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:

ipython
ipython (1.2.4) ; implementation_name == "pypy"

So, this will trigger two separate dependency resolutions:

  • One with the following overrides: {<Package slash-1.10.0>: {'ipython': <Dependency IPython (*)>}}
  • One with the following override: {<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.

@sdispater sdispater added the area/solver Related to the dependency resolver label Apr 24, 2020
@sdispater sdispater added this to the 1.1 milestone Apr 24, 2020
@sdispater sdispater requested a review from a team April 24, 2020 10:01
@abn abn merged commit f8bde0e into develop Apr 24, 2020
@sdispater sdispater deleted the fix-handling-of-markers-when-resolving branch April 28, 2020 10:22
@sdispater sdispater mentioned this pull request Jun 26, 2020
@lvkswrks
Copy link

Probably resolves: #992 as well

@rayluo rayluo mentioned this pull request Jul 22, 2020
3 tasks
@abn abn linked an issue Aug 9, 2020 that may be closed by this pull request
3 tasks
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/solver Related to the dependency resolver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Circular dependencies / recursion depth (MVP example)
3 participants