Skip to content

Commit

Permalink
Tie-break requirements with package name
Browse files Browse the repository at this point in the history
This makes the ordering deterministic to improve debugging and user
experience.
  • Loading branch information
uranusjr committed Nov 4, 2020
1 parent 0512785 commit 69a95cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/9100.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The new resolver now resolves packages in a deterministic order.
3 changes: 2 additions & 1 deletion src/pip/_internal/resolution/resolvelib/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def get_preference(
):
# type: (...) -> Any
transitive = all(parent is not None for _, parent in information)
return (transitive, bool(candidates))
key = next(iter(candidates)).name if candidates else ""
return (transitive, key)

def find_matches(self, requirements):
# type: (Sequence[Requirement]) -> Iterable[Candidate]
Expand Down

0 comments on commit 69a95cf

Please sign in to comment.