Skip to content

Commit 2452572

Browse files
committed
Merge branch 'main' into release/25.0.1
2 parents 1acc485 + 7e9c87a commit 2452572

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+56
-86
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ c7ee560e00b85f7486b452c14ff49e4737996eda # Blacken tools/
3434
94999255d5ede440c37137d210666fdf64302e75 # Reformat the codebase, with black
3535
585037a80a1177f1fa92e159a7079855782e543e # Cleanup implicit string concatenation
3636
8a6f6ac19b80a6dc35900a47016c851d9fcd2ee2 # Blacken src/pip/_internal/resolution directory
37+
acfcae8941bb12ecfc372a05c875a7b414992604 # Reformat with Black's 2025 code style

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
exclude: .patch
1818

1919
- repo: https://github.com/psf/black-pre-commit-mirror
20-
rev: 24.10.0
20+
rev: 25.1.0
2121
hooks:
2222
- id: black
2323

build-project.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
from os import PathLike
88
from pathlib import Path
99
from types import SimpleNamespace
10+
from typing import Union
1011

1112

1213
class EnvBuilder(venv.EnvBuilder):
1314
"""A subclass of venv.EnvBuilder that exposes the python executable command."""
1415

1516
def ensure_directories(
16-
self, env_dir: str | bytes | PathLike[str] | PathLike[bytes]
17+
self, env_dir: Union[str, bytes, "PathLike[str]", "PathLike[bytes]"]
1718
) -> SimpleNamespace:
1819
context = super().ensure_directories(env_dir)
1920
self.env_exec_cmd = context.env_exec_cmd

news/13156.bugfix.rst

Lines changed: 1 addition & 0 deletions

news/13182.trivial.rst

Lines changed: 1 addition & 0 deletions

noxfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Automation using nox.
2-
"""
1+
"""Automation using nox."""
32

43
import argparse
54
import glob

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ select = [
184184
"W",
185185
"RUF100",
186186
"UP",
187+
"FA102", # future-required-type-annotation
187188
]
188189

189190
[tool.ruff.lint.isort]

src/pip/_internal/build_env.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Build Environment used for isolation during sdist building
2-
"""
1+
"""Build Environment used for isolation during sdist building"""
32

43
import logging
54
import os

src/pip/_internal/cache.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Cache Management
2-
"""
1+
"""Cache Management"""
32

43
import hashlib
54
import json

src/pip/_internal/cli/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"""Subpackage containing all of pip's command line interface related code
2-
"""
1+
"""Subpackage containing all of pip's command line interface related code"""
32

43
# This file intentionally does not import submodules

src/pip/_internal/cli/autocompletion.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Logic that powers autocompletion installed by ``pip completion``.
2-
"""
1+
"""Logic that powers autocompletion installed by ``pip completion``."""
32

43
import optparse
54
import os

src/pip/_internal/cli/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Primary application entrypoint.
2-
"""
1+
"""Primary application entrypoint."""
32

43
import locale
54
import logging

src/pip/_internal/cli/main_parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""A single place for constructing and exposing the main parser
2-
"""
1+
"""A single place for constructing and exposing the main parser"""
32

43
import os
54
import subprocess

src/pip/_internal/index/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
"""Index interaction code
2-
"""
1+
"""Index interaction code"""

src/pip/_internal/models/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
"""A package that contains models that represent entities.
2-
"""
1+
"""A package that contains models that represent entities."""

src/pip/_internal/models/direct_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" PEP 610 """
1+
"""PEP 610"""
22

33
import json
44
import re

src/pip/_internal/network/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
"""Contains purely network-related utilities.
2-
"""
1+
"""Contains purely network-related utilities."""

src/pip/_internal/network/cache.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""HTTP cache implementation.
2-
"""
1+
"""HTTP cache implementation."""
32

43
import os
54
from contextlib import contextmanager

src/pip/_internal/network/download.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Download files with progress indicators.
2-
"""
1+
"""Download files with progress indicators."""
32

43
import email.message
54
import logging

src/pip/_internal/network/xmlrpc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""xmlrpclib.Transport implementation
2-
"""
1+
"""xmlrpclib.Transport implementation"""
32

43
import logging
54
import urllib.parse

src/pip/_internal/operations/build/metadata.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Metadata generation logic for source distributions.
2-
"""
1+
"""Metadata generation logic for source distributions."""
32

43
import os
54

src/pip/_internal/operations/build/metadata_editable.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Metadata generation logic for source distributions.
2-
"""
1+
"""Metadata generation logic for source distributions."""
32

43
import os
54

src/pip/_internal/operations/build/metadata_legacy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Metadata generation logic for legacy source distributions.
2-
"""
1+
"""Metadata generation logic for legacy source distributions."""
32

43
import logging
54
import os

src/pip/_internal/operations/check.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Validation of dependencies of packages
2-
"""
1+
"""Validation of dependencies of packages"""
32

43
import logging
54
from contextlib import suppress
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
"""For modules related to installing packages.
2-
"""
1+
"""For modules related to installing packages."""

src/pip/_internal/operations/install/editable_legacy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Legacy editable installation process, i.e. `setup.py develop`.
2-
"""
1+
"""Legacy editable installation process, i.e. `setup.py develop`."""
32

43
import logging
54
from typing import Optional, Sequence

src/pip/_internal/operations/install/wheel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Support for installing and building the "wheel" binary package format.
2-
"""
1+
"""Support for installing and building the "wheel" binary package format."""
32

43
import collections
54
import compileall

src/pip/_internal/operations/prepare.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Prepares a distribution for installation
2-
"""
1+
"""Prepares a distribution for installation"""
32

43
# The following comment should be removed at some point in the future.
54
# mypy: strict-optional=False

src/pip/_internal/req/req_uninstall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _script_names(
3838

3939

4040
def _unique(
41-
fn: Callable[..., Generator[Any, None, None]]
41+
fn: Callable[..., Generator[Any, None, None]],
4242
) -> Callable[..., Generator[Any, None, None]]:
4343
@functools.wraps(fn)
4444
def unique(*args: Any, **kw: Any) -> Generator[Any, None, None]:

src/pip/_internal/utils/compatibility_tags.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Generate and work with PEP 425 Compatibility Tags.
2-
"""
1+
"""Generate and work with PEP 425 Compatibility Tags."""
32

43
import re
54
from typing import List, Optional, Tuple

src/pip/_internal/utils/datetime.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""For when pip wants to check the date or time.
2-
"""
1+
"""For when pip wants to check the date or time."""
32

43
import datetime
54

src/pip/_internal/utils/entrypoints.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ def get_best_invocation_for_this_python() -> str:
7777

7878
# Try to use the basename, if it's the first executable.
7979
found_executable = shutil.which(exe_name)
80-
if found_executable and os.path.samefile(found_executable, exe):
80+
# Virtual environments often symlink to their parent Python binaries, but we don't
81+
# want to treat the Python binaries as equivalent when the environment's Python is
82+
# not on PATH (not activated). Thus, we don't follow symlinks.
83+
if found_executable and os.path.samestat(os.lstat(found_executable), os.lstat(exe)):
8184
return exe_name
8285

8386
# Use the full executable name, because we couldn't find something simpler.

src/pip/_internal/utils/filetypes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Filetype information.
2-
"""
1+
"""Filetype information."""
32

43
from typing import Tuple
54

src/pip/_internal/utils/unpacking.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Utilities related archives.
2-
"""
1+
"""Utilities related archives."""
32

43
import logging
54
import os

src/pip/_internal/utils/wheel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Support functions for working with wheel files.
2-
"""
1+
"""Support functions for working with wheel files."""
32

43
import logging
54
from email.message import Message

src/pip/_internal/wheel_builder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Orchestrator for building wheels from InstallRequirements.
2-
"""
1+
"""Orchestrator for building wheels from InstallRequirements."""
32

43
import logging
54
import os.path

tests/functional/test_cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Basic CLI functionality checks.
2-
"""
1+
"""Basic CLI functionality checks."""
32

43
import subprocess
54
import sys

tests/functional/test_configuration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Tests for the config command
2-
"""
1+
"""Tests for the config command"""
32

43
import re
54
import textwrap

tests/lib/configuration_helpers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Helpers for tests that check configuration
2-
"""
1+
"""Helpers for tests that check configuration"""
32

43
import contextlib
54
import functools

tests/lib/filesystem.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Helpers for filesystem-dependent tests.
2-
"""
1+
"""Helpers for filesystem-dependent tests."""
32

43
import os
54
from contextlib import contextmanager

tests/lib/options_helpers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Provides helper classes for testing option handling in pip
2-
"""
1+
"""Provides helper classes for testing option handling in pip"""
32

43
from optparse import Values
54
from typing import List, Tuple

tests/lib/requests_mocks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Helper classes as mocks for requests objects.
2-
"""
1+
"""Helper classes as mocks for requests objects."""
32

43
from io import BytesIO
54
from typing import Any, Callable, Dict, Iterator, List, Optional

tests/lib/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def make_environ(self) -> Dict[str, Any]:
4848

4949

5050
def _mock_wsgi_adapter(
51-
mock: Callable[["WSGIEnvironment", "StartResponse"], "WSGIApplication"]
51+
mock: Callable[["WSGIEnvironment", "StartResponse"], "WSGIApplication"],
5252
) -> "WSGIApplication":
5353
"""Uses a mock to record function arguments and provide
5454
the actual function that should respond.

tests/lib/test_wheel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Tests for wheel helper.
2-
"""
1+
"""Tests for wheel helper."""
32

43
import csv
54
from email import message_from_string

tests/lib/wheel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Helper for building wheels as would be in test cases.
2-
"""
1+
"""Helper for building wheels as would be in test cases."""
32

43
import csv
54
import itertools

tests/unit/resolution_resolvelib/test_resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def resolver(preparer: RequirementPreparer, finder: PackageFinder) -> Resolver:
3535

3636

3737
def _make_graph(
38-
edges: List[Tuple[Optional[str], Optional[str]]]
38+
edges: List[Tuple[Optional[str], Optional[str]]],
3939
) -> "DirectedGraph[Optional[str]]":
4040
"""Build graph from edge declarations."""
4141

tests/unit/test_appdirs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_user_cache_dir_unicode(self, monkeypatch: pytest.MonkeyPatch) -> None:
6666
return
6767

6868
def my_get_win_folder(csidl_name: str) -> str:
69-
return "\u00DF\u00E4\u03B1\u20AC"
69+
return "\u00df\u00e4\u03b1\u20ac"
7070

7171
monkeypatch.setattr(
7272
platformdirs.windows, # type: ignore

tests/unit/test_base_command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class FakeCommandWithUnicode(FakeCommand):
5656
_name = "fake_unicode"
5757

5858
def run(self, options: Values, args: List[str]) -> int:
59-
logging.getLogger("pip.tests").info(b"bytes here \xE9")
60-
logging.getLogger("pip.tests").info(b"unicode here \xC3\xA9".decode("utf-8"))
59+
logging.getLogger("pip.tests").info(b"bytes here \xe9")
60+
logging.getLogger("pip.tests").info(b"unicode here \xc3\xa9".decode("utf-8"))
6161
return SUCCESS
6262

6363

tests/unit/test_configuration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Tests for all things related to the configuration
2-
"""
1+
"""Tests for all things related to the configuration"""
32

43
import re
54
from unittest.mock import MagicMock

tests/unit/test_models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Tests for various classes in pip._internal.models
2-
"""
1+
"""Tests for various classes in pip._internal.models"""
32

43
from pip._vendor.packaging.version import parse as parse_version
54

tools/release/check_version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Checks if the version is acceptable, as per this project's release process.
2-
"""
1+
"""Checks if the version is acceptable, as per this project's release process."""
32

43
import sys
54
from datetime import datetime

0 commit comments

Comments
 (0)