-
Notifications
You must be signed in to change notification settings - Fork 1
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
A faster Installed-First policy #55
Conversation
TravisCI is expected to fail until #54 is merged. |
@@ -52,12 +52,7 @@ def _create_rules(self, request): | |||
pool.package_id(package) | |||
for package in pool.what_provides(requirement) | |||
] | |||
self._policy.add_packages_by_id(requirement_ids) | |||
|
|||
# Add installed packages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_requirements
now implies hard requirements, not just packages we should prefer if possible. The Policy
gets a reference to installed_repository
and can figure out on its own which packages are currently installed if it wants to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from an API POV, I wonder if it would not be simpler to remove add_packages_by_id
altogether, and make it an implementation detail (called at creation time from a passed installed_repository
).
I marked the |
Failures are due to Surely the |
|
||
import six | ||
|
||
from collections import OrderedDict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: let's put stdlib import first
The PR is a bit big, can we split into at least 2 ?
|
This PR introduces a Policy that provides "installed first" behavior to the dependency solver, as well as a few helper classes.
Benchmarks are in issue #52.
It is implemented as a giant priority queue where the priorities split into three bands, in order from highest to lowest:
Within each group, packages are ordered descending by version, such that newer packages are tried first.
I'm currently using the notion that version objects are always comparable to define an ordering over all packages and assign priorities based on that, rather than grouping packages by name. In addition to being fast, easy to write, and easy to understand, it leads to a few interesting properties:
Things it does
curl-7.3.0
comes well beforeBiggus-0.7.0
.pep8 1.4.6
thenscipy 0.15.0
thenpep8 0.6.1
,>=
request #42,clause
literals and still be quite fast.To see this play out, there's a
PolicyLogger
class that is currently wrappingInstalledFirstPolicy
and keeping track of things.Things it doesn't do
clause
instances themselves,It currently suffers from the unrelated backtracking bug that motivated #54, and passes all tox tests with that patch applied.
If this is suitable, I would think that this closes #42 and #52.