-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
improve performance of version solver for dependencies with many versions #8191
Comments
the code you've linked has nothing much to do with the main part of poetry's search, which is neither depth-first nor breadth-first. what you want to think about is changing the heuristic by which poetry chooses the next package to resolve - poetry/src/poetry/mixology/version_solver.py Lines 443 to 475 in 01657dd
eg most of the cases that currently go wrong are made much faster by reversing the preference for packages with fewer available versions. However: there's every chance that making that change will introduce new pathological cases - there is no silver bullet. Feel free to experiment. |
thats a great pointer, thanks! i must admit I'm not too familiar with the poetry codebase except as a user, seems I was looking in the wrong place. some of the test cases in tests/mixology/version_solver/test_backtracking.py look like interesting threads to pull on, I'll fiddle with those to see if I can more exactly define the issue and a suggested improvement |
using the backtracking unit test cases as a model I came up with a case that reproduces the performance issue I'm circling around
this test passes but the solver takes quite a long time
as suggested, flipping the preference for packages with fewer versions speeds solving up tremendously
I'll fiddle to see if I can figure out a way to get around this without breaking the solver for more common cases. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
The current dependency solver can perform suboptimally for packages with many frequent releases creating long chains to explore.
botocore
in particular seems to be problematic and can produce dead ends in the graph of possible package combinations that poetry takes a long time to resolve out of.See:
faust-large-message-serializer = "^2.0.1"
#7875poetry add
vspoetry install
for ome-zarr package #7856The workarounds for these are generally of the "pin package X" variety, which works well but doesn't make for the best user experience and adds requirements to a pyproject.toml that a developer doesn't necessarily care about. The documentation section on "why-is-the-dependency-resolution-process-slow" also suggest adding pins as a solution for speed up resolution.
Investigate improving the performance of the version solver in these cases, preferably without too much impact on non-pathologic cases.
The text was updated successfully, but these errors were encountered: