From 1891d7964f8721e13b35338fc3599d455cb2b04e Mon Sep 17 00:00:00 2001 From: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Tue, 23 Jun 2020 02:53:31 -0700 Subject: [PATCH] add --unstable-feature=shallow_wheels! --- news/8448.feature | 2 +- src/pip/_internal/cli/cmdoptions.py | 2 +- src/pip/_internal/cli/req_command.py | 2 +- src/pip/_internal/commands/install.py | 1 + src/pip/_internal/commands/wheel.py | 1 + src/pip/_internal/resolution/resolvelib/resolver.py | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/news/8448.feature b/news/8448.feature index 5cc8b451007..4ca54441fed 100644 --- a/news/8448.feature +++ b/news/8448.feature @@ -1 +1 @@ -Add a set of utilities in ``pip._internal.network.shallow`` for fetching metadata from remote wheel files without downloading the entire file. Link these utilities into the v2 resolver by adding a new ShallowWheelDistribution AbstractDistribution subclass. Expose this behavior via a --shallow-wheels command-line option to ``pip download``. This produces a marked performance improvement. +Add a set of utilities in ``pip._internal.network.shallow`` for fetching metadata from remote wheel files without downloading the entire file. Link these utilities into the v2 resolver by adding a new ShallowWheelDistribution AbstractDistribution subclass. Expose this behavior via a --unstable-feature=shallow_wheels command-line option to ``pip download``. This produces a marked performance improvement. diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py index 4c557efa80f..2af2decc784 100644 --- a/src/pip/_internal/cli/cmdoptions.py +++ b/src/pip/_internal/cli/cmdoptions.py @@ -919,7 +919,7 @@ def check_list_path_option(options): metavar='feature', action='append', default=[], - choices=['resolver'], + choices=['resolver', 'shallow_wheels'], help=SUPPRESS_HELP, # TODO: Enable this when the resolver actually works. # help='Enable unstable feature(s) that may be backward incompatible.', ) # type: Callable[..., Option] diff --git a/src/pip/_internal/cli/req_command.py b/src/pip/_internal/cli/req_command.py index db2b044a450..8b1ca24eacb 100644 --- a/src/pip/_internal/cli/req_command.py +++ b/src/pip/_internal/cli/req_command.py @@ -231,7 +231,7 @@ def make_requirement_preparer( finder=finder, require_hashes=options.require_hashes, use_user_site=use_user_site, - use_shallow_wheels=True, + use_shallow_wheels=('shallow_wheels' in options.unstable_features), ) @staticmethod diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index df21e7ceca2..2e416faeca8 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -326,6 +326,7 @@ def run(self, options, args): requirement_set = resolver.resolve( reqs, check_supported_wheels=not options.target_dir ) + requirement_set.perform_all_final_hydration() try: pip_req = requirement_set.get_requirement("pip") diff --git a/src/pip/_internal/commands/wheel.py b/src/pip/_internal/commands/wheel.py index 0f718566bd0..6aaa4f01b70 100644 --- a/src/pip/_internal/commands/wheel.py +++ b/src/pip/_internal/commands/wheel.py @@ -155,6 +155,7 @@ def run(self, options, args): requirement_set = resolver.resolve( reqs, check_supported_wheels=True ) + requirement_set.perform_all_final_hydration() reqs_to_build = [ r for r in requirement_set.requirements.values() diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py index 12f72ecee72..35cb6dda42d 100644 --- a/src/pip/_internal/resolution/resolvelib/resolver.py +++ b/src/pip/_internal/resolution/resolvelib/resolver.py @@ -9,7 +9,7 @@ from pip._internal.distributions.shallow_wheel import ( DistributionNeedingFinalHydration, ) -from pip._internal.exceptions import DistributionNotFound, InstallationError +from pip._internal.exceptions import InstallationError from pip._internal.req.req_set import RequirementSet from pip._internal.resolution.base import BaseResolver from pip._internal.resolution.resolvelib.provider import PipProvider