Browse Source

Resolve user-requested requirements first

pull/8924/head
Tzu-ping Chung 4 weeks ago
parent
commit
c2de8974d4
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      src/pip/_internal/resolution/resolvelib/provider.py

+ 10
- 3
src/pip/_internal/resolution/resolvelib/provider.py View File

@@ -115,11 +115,18 @@ class PipProvider(AbstractProvider):
self,
resolution, # type: Optional[Candidate]
candidates, # type: Sequence[Candidate]
information # type: Sequence[Tuple[Requirement, Candidate]]
information # type: Sequence[Tuple[Requirement, Optional[Candidate]]]
):
# type: (...) -> Any
# Use the "usual" value for now
return len(candidates)
"""Return a sort key to determine what dependency to look next.

A smaller value makes a dependency higher priority. We put direct
(user-requested) dependencies first since they may contain useful
user-specified version ranges. Users tend to expect us to catch
problems in them early as well.
"""
transitive = all(parent is not None for _, parent in information)
return (transitive, len(candidates))

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


Loading…
Cancel
Save