After least versions, the package with least dependencies is chosen #5
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.
This PR makes sure that first the package with least satisfying versions is chosen. If there are multiple packages with e.g. only one satisfying version, a second metric will decide the winner: the amount of dependencies of the highest satisfying version.
This way (if e.g. there are many dependencies with an exact pin), less dependencies need to be inspected before the next decision, improving solving time for big nested packages.
In my case, I'm using a PackageSource object that will on demand resolve the dependencies and available versions for a package by inspecting wheels from PyPI repositories. This adds overhead to the algorithm, but allows to start
solve()
with an empty (undiscovered) tree and one or more root dependencies. Getting wheels for packages with many dependencies takes a lot of time (and might be completely unnecessary if we inspect only few dependencies for a different term).