-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Rework get_installation_order
to allow for dependency cycles
#8127
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
Conversation
If you mean the root node in graph being |
Alrighty! IMO we should document this expectation on AbstractResolver. :) All good then, this is ready for review... once I fix the failing test. I don't think we'd ever get a graph where some edges aren't accessible from the root node. passed to the (
[
(None, "pkg1"),
(None, "pkg2"),
(None, "pkg3"),
(None, "pkg4"),
("pkg5", "pkg1"),
("pkg6", "pkg1"),
("pkg7", "pkg1"),
("pkg7", "pkg5"),
("pkg7", "pkg6"),
],
[
"pkg1==0.0.1",
"pkg5==0.0.1",
"pkg6==0.0.1",
"pkg7==0.0.1",
],
), |
You won’t, the resolver guarentees this. (Maybe worthwhile to add a test on ResolveLib though? Not sure.) |
Property based testing would be ideal for this :-) |
This reverts commit f927f9a.
Hmm... A good test case for this is taking a graph like |
Sitting and working on this now. |
59884ba
to
be9226d
Compare
IT WORKS! IT WORKS! IT WORKS! |
We take the length for the longest path to any node from root, ignoring any paths that contain any node twice (i.e. cycles).
be9226d
to
ea52559
Compare
O(n) list lookups to O(1) set lookups
I can’t say I grok the logic, but can’t pick on an obvious problem either. All YAML tests on circular dependencies pass as well. Can you check what is failing this one?
I categorsied it under |
Ah, yes. That's a test that's supposed to be testing for what conflicts we report (there's a |
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.
I like the way that algorithm turned out! It's pretty comprehensible, which isn't always the case for graph algorithms 🙂
Switches our ordering strategy to "weight" nodes to be based on: The length of the longest path, from root to the node (ignoring any paths containing cycles).
Our graph is a directed cyclic graph, so, that's fun to think about. :)