Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable PEP 658 for the legacy resolver #12163

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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