Skip to content

Commit

Permalink
Merge pull request #12163 from pfmoore/fix_12156
Browse files Browse the repository at this point in the history
Disable PEP 658 for the legacy resolver
  • Loading branch information
pfmoore authored Jul 21, 2023
2 parents 593b85f + 39aa7ed commit 1d4674c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/12156.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disable PEP 658 metadata fetching with the legacy resolver.
3 changes: 3 additions & 0 deletions src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def make_requirement_preparer(
"""
temp_build_dir_path = temp_build_dir.path
assert temp_build_dir_path is not None
legacy_resolver = False

resolver_variant = cls.determine_resolver_variant(options)
if resolver_variant == "2020-resolver":
Expand All @@ -300,6 +301,7 @@ def make_requirement_preparer(
"production."
)
else:
legacy_resolver = True
lazy_wheel = False
if "fast-deps" in options.features_enabled:
logger.warning(
Expand All @@ -320,6 +322,7 @@ def make_requirement_preparer(
use_user_site=use_user_site,
lazy_wheel=lazy_wheel,
verbosity=verbosity,
legacy_resolver=legacy_resolver,
)

@classmethod
Expand Down
9 changes: 9 additions & 0 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def __init__(
use_user_site: bool,
lazy_wheel: bool,
verbosity: int,
legacy_resolver: bool,
) -> None:
super().__init__()

Expand Down Expand Up @@ -259,6 +260,9 @@ def __init__(
# How verbose should underlying tooling be?
self.verbosity = verbosity

# Are we using the legacy resolver?
self.legacy_resolver = legacy_resolver

# Memoized downloaded files, as mapping of url: path.
self._downloaded: Dict[str, str] = {}

Expand Down Expand Up @@ -365,6 +369,11 @@ def _fetch_metadata_only(
self,
req: InstallRequirement,
) -> Optional[BaseDistribution]:
if self.legacy_resolver:
logger.debug(
"Metadata-only fetching is not used in the legacy resolver",
)
return None
if self.require_hashes:
logger.debug(
"Metadata-only fetching is not used as hash checking is required",
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_req.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def _basic_resolver(
use_user_site=False,
lazy_wheel=False,
verbosity=0,
legacy_resolver=True,
)
yield Resolver(
preparer=preparer,
Expand Down

0 comments on commit 1d4674c

Please sign in to comment.