Skip to content

Commit f718a8f

Browse files
authored
Optimize upgrade of already-satisfied pinned requirement (#7132)
2 parents a6b0605 + 0492e80 commit f718a8f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

news/7132.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip reaching out to the package index, if a pinned version is already satisfied.

src/pip/_internal/legacy_resolve.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ def _check_skip_installed(self, req_to_install):
267267
# requirements we have to pull the tree down and inspect to assess
268268
# the version #, so it's handled way down.
269269
if not req_to_install.link:
270+
if req_to_install.is_pinned:
271+
# No need to check the index for a better version.
272+
return 'already satisfied'
273+
270274
try:
271275
self.finder.find_requirement(req_to_install, upgrade=True)
272276
except BestVersionAlreadyInstalled:

0 commit comments

Comments
 (0)