Skip to content

Commit a5b2e5c

Browse files
committed
Merge branch 'main' into release/24.1.2
2 parents 412211e + af00870 commit a5b2e5c

19 files changed

+450
-117
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
- id: black
2323

2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.4.7
25+
rev: v0.5.0
2626
hooks:
2727
- id: ruff
2828
args: [--fix, --exit-non-zero-on-fix]

news/12683.feature.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Disable pip's self version check when invoking a pip subprocess to install
2+
PEP 517 build requirements.

news/12712.feature.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve dependency resolution performance by caching platform compatibility
2+
tags during wheel cache lookup.

news/12781.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix finding hardlink targets in tar files with an ignored top-level directory.

news/12791.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve pip install performance. The installed packages printout is
2+
now calculated in linear time instead of quadratic time.

news/12796.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the preload list for the ``DEBUNDLED`` case, to replace ``pep517`` that has been renamed to ``pyproject_hooks``.

news/12797.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use tomllib from the stdlib if available, rather than tomli

news/12805.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update ruff to 0.5.0

news/typing_extensions.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade typing_extensions to 4.12.2

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ distlib = "https://bitbucket.org/pypa/distlib/raw/master/LICENSE.txt"
151151

152152
[tool.ruff]
153153
src = ["src"]
154-
target-version = "py38"
155154
line-length = 88
156155
extend-exclude = [
157156
"_vendor",

src/pip/_internal/build_env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def _install_requirements(
241241
"--prefix",
242242
prefix.path,
243243
"--no-warn-script-location",
244+
"--disable-pip-version-check",
244245
]
245246
if logger.getEffectiveLevel() <= logging.DEBUG:
246247
args.append("-vv")

src/pip/_internal/commands/install.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from optparse import SUPPRESS_HELP, Values
88
from typing import List, Optional
99

10+
from pip._vendor.packaging.utils import canonicalize_name
1011
from pip._vendor.rich import print_json
1112

1213
from pip._internal.cache import WheelCache
@@ -472,25 +473,29 @@ def run(self, options: Values, args: List[str]) -> int:
472473
)
473474
env = get_environment(lib_locations)
474475

476+
# Display a summary of installed packages, with extra care to
477+
# display a package name as it was requested by the user.
475478
installed.sort(key=operator.attrgetter("name"))
476-
items = []
477-
for result in installed:
478-
item = result.name
479-
try:
480-
installed_dist = env.get_distribution(item)
481-
if installed_dist is not None:
482-
item = f"{item}-{installed_dist.version}"
483-
except Exception:
484-
pass
485-
items.append(item)
479+
summary = []
480+
installed_versions = {}
481+
for distribution in env.iter_all_distributions():
482+
installed_versions[distribution.canonical_name] = distribution.version
483+
for package in installed:
484+
display_name = package.name
485+
version = installed_versions.get(canonicalize_name(display_name), None)
486+
if version:
487+
text = f"{display_name}-{version}"
488+
else:
489+
text = display_name
490+
summary.append(text)
486491

487492
if conflicts is not None:
488493
self._warn_about_conflicts(
489494
conflicts,
490495
resolver_variant=self.determine_resolver_variant(options),
491496
)
492497

493-
installed_desc = " ".join(items)
498+
installed_desc = " ".join(summary)
494499
if installed_desc:
495500
write_output(
496501
"Successfully installed %s",

src/pip/_internal/metadata/importlib/_envs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,10 @@ def _iter_distributions(self) -> Iterator[BaseDistribution]:
181181
yield from finder.find_linked(location)
182182

183183
def get_distribution(self, name: str) -> Optional[BaseDistribution]:
184+
canonical_name = canonicalize_name(name)
184185
matches = (
185186
distribution
186187
for distribution in self.iter_all_distributions()
187-
if distribution.canonical_name == canonicalize_name(name)
188+
if distribution.canonical_name == canonical_name
188189
)
189190
return next(matches, None)

src/pip/_internal/pyproject.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import importlib.util
22
import os
3+
import sys
34
from collections import namedtuple
45
from typing import Any, List, Optional
56

6-
from pip._vendor import tomli
7+
if sys.version_info >= (3, 11):
8+
import tomllib
9+
else:
10+
from pip._vendor import tomli as tomllib
11+
712
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
813

914
from pip._internal.exceptions import (
@@ -61,7 +66,7 @@ def load_pyproject_toml(
6166

6267
if has_pyproject:
6368
with open(pyproject_toml, encoding="utf-8") as f:
64-
pp_toml = tomli.loads(f.read())
69+
pp_toml = tomllib.loads(f.read())
6570
build_system = pp_toml.get("build-system")
6671
else:
6772
build_system = None

src/pip/_internal/resolution/resolvelib/factory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def __init__(
121121
self._extras_candidate_cache: Dict[
122122
Tuple[int, FrozenSet[NormalizedName]], ExtrasCandidate
123123
] = {}
124+
self._supported_tags_cache = get_supported()
124125

125126
if not ignore_installed:
126127
env = get_default_environment()
@@ -608,7 +609,7 @@ def get_wheel_cache_entry(
608609
return self._wheel_cache.get_cache_entry(
609610
link=link,
610611
package_name=name,
611-
supported_tags=get_supported(),
612+
supported_tags=self._supported_tags_cache,
612613
)
613614

614615
def get_dist_to_uninstall(self, candidate: Candidate) -> Optional[BaseDistribution]:

src/pip/_internal/utils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _onerror_ignore(*_args: Any) -> None:
149149

150150

151151
def _onerror_reraise(*_args: Any) -> None:
152-
raise
152+
raise # noqa: PLE0704 - Bare exception used to reraise existing exception
153153

154154

155155
def rmtree_errorhandler(

src/pip/_vendor/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def vendored(modulename):
6565
vendored("packaging")
6666
vendored("packaging.version")
6767
vendored("packaging.specifiers")
68-
vendored("pep517")
6968
vendored("pkg_resources")
7069
vendored("platformdirs")
7170
vendored("progress")
71+
vendored("pyproject_hooks")
7272
vendored("requests")
7373
vendored("requests.exceptions")
7474
vendored("requests.packages")
@@ -111,6 +111,7 @@ def vendored(modulename):
111111
vendored("rich.text")
112112
vendored("rich.traceback")
113113
vendored("tenacity")
114-
vendored("tomli")
114+
if sys.version_info < (3, 11):
115+
vendored("tomli")
115116
vendored("truststore")
116117
vendored("urllib3")

0 commit comments

Comments
 (0)