Skip to content

Commit 157eada

Browse files
authoredJan 26, 2025··
Add support for --pip-version 25.0. (#2652)
1 parent d365641 commit 157eada

File tree

9 files changed

+50
-21
lines changed

9 files changed

+50
-21
lines changed
 

‎.github/workflows/ci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ jobs:
7474
- tox-env: py27-pip20
7575
- tox-env: py38-pip22_3_1
7676
- tox-env: py311-pip23_3_2
77-
- tox-env: py313-pip24_3_1
78-
- tox-env: py314-pip24_3_1
77+
- tox-env: py313-pip25_0
78+
- tox-env: py314-pip25_0
7979
- tox-env: pypy310-pip24_3_1
8080

8181
# Integration tests, split most into two shards:
@@ -94,14 +94,14 @@ jobs:
9494
- tox-env: py311-pip23_3_2-integration
9595
pex-test-pos-args: --shard 2/2
9696

97-
- tox-env: py313-pip24_3_1-integration
97+
- tox-env: py313-pip25_0-integration
9898
pex-test-pos-args: --shard 1/2
99-
- tox-env: py313-pip24_3_1-integration
99+
- tox-env: py313-pip25_0-integration
100100
pex-test-pos-args: --shard 2/2
101101

102-
- tox-env: py314-pip24_3_1-integration
102+
- tox-env: py314-pip25_0-integration
103103
pex-test-pos-args: --shard 1/2
104-
- tox-env: py314-pip24_3_1-integration
104+
- tox-env: py314-pip25_0-integration
105105
pex-test-pos-args: --shard 2/2
106106

107107
- tox-env: pypy310-pip24_3_1-integration
@@ -149,14 +149,14 @@ jobs:
149149
matrix:
150150
include:
151151
- python-version: [ 3, 13 ]
152-
tox-env: py313-pip24_3_1
152+
tox-env: py313-pip25_0
153153
tox-env-python: python3.11
154154
- python-version: [ 3, 13 ]
155-
tox-env: py313-pip24_3_1-integration
155+
tox-env: py313-pip25_0-integration
156156
tox-env-python: python3.11
157157
pex-test-pos-args: --shard 1/2
158158
- python-version: [ 3, 13 ]
159-
tox-env: py313-pip24_3_1-integration
159+
tox-env: py313-pip25_0-integration
160160
tox-env-python: python3.11
161161
pex-test-pos-args: --shard 2/2
162162
steps:

‎CHANGES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release Notes
22

3+
## 2.32.0
4+
5+
This release adds support for Pip 25.0.
6+
7+
* Add support for `--pip-version 25.0`. (#2652)
8+
39
## 2.31.0
410

511
This release adds `pex3 lock subset <reqs...> --lock existing.lock` for

‎pex/pip/dependencies/requires.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from __future__ import absolute_import, print_function
55

66
import logging
7+
import sys
78

89
logger = logging.getLogger(__name__)
910

@@ -78,10 +79,14 @@ def patch_requires_dists(dist_type, requires_dists_function_name):
7879
# `pkg_resources.Distribution` objects to a `pip._internal.metadata` interface. The
7980
# `pip._internal.metadata.pkg_resources.Distribution` type delegates to
8081
# `pip._vendor.pkg_resources.Distribution`, which we've patched above, but the
81-
# `pip._internal.metadata.importlib.Distribution` type needs its own patching.
82-
try:
83-
from pip._internal.metadata.importlib import Distribution # type: ignore[import]
82+
# `pip._internal.metadata.importlib.Distribution` type needs its own patching. N.B.: Pip only
83+
# uses the pip._internal.metadata.importlib package for Python >=3.11 and code in that package
84+
# relies on that fact, using some syntax not supported in earlier Python versions; so we guard
85+
# this patch. See discussion here: https://github.com/pypa/pip/pull/11685/files#r1929802395
86+
if sys.version_info[:2] >= (3, 11):
87+
try:
88+
from pip._internal.metadata.importlib import Distribution # type: ignore[import]
8489

85-
patch_requires_dists(Distribution, "iter_dependencies")
86-
except ImportError:
87-
pass
90+
patch_requires_dists(Distribution, "iter_dependencies")
91+
except ImportError:
92+
pass

‎pex/pip/foreign_platform/requires_python.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# N.B.: The following environment variable is used by the Pex runtime to control Pip and must be
1010
# kept in-sync with `__init__.py`.
1111
with open(os.environ.pop("_PEX_PYTHON_VERSIONS_FILE")) as fp:
12-
PYTHON_FULL_VERSIONS = json.load(fp)
13-
PYTHON_VERSIONS = sorted(set((version[0], version[1]) for version in PYTHON_FULL_VERSIONS))
12+
PYTHON_FULL_VERSIONS = sorted(tuple(version) for version in json.load(fp))
13+
PYTHON_VERSIONS = sorted(set(version[:2] for version in PYTHON_FULL_VERSIONS))
1414

1515

1616
def patch():

‎pex/pip/tool.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,6 @@ def _spawn_pip_isolated(
374374
pip_args = [
375375
# We vendor the version of pip we want so pip should never check for updates.
376376
"--disable-pip-version-check",
377-
# If we want to warn about a version of python we support, we should do it, not pip.
378-
"--no-python-version-warning",
379377
# If pip encounters a duplicate file path during its operations we don't want it to
380378
# prompt and we'd also like to know about this since it should never occur. We leverage
381379
# the pip global option:
@@ -387,6 +385,12 @@ def _spawn_pip_isolated(
387385
# We are not interactive.
388386
"--no-input",
389387
]
388+
if self.version < PipVersion.v25_0:
389+
# If we want to warn about a version of python we support, we should do it, not pip.
390+
# That said, the option does nothing in Pip 25.0 and is deprecated and slated for
391+
# removal.
392+
pip_args.append("--no-python-version-warning")
393+
390394
python_interpreter = interpreter or PythonInterpreter.get()
391395
pip_args.extend(
392396
self._calculate_resolver_version_args(

‎pex/pip/version.py

+9
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,15 @@ def values(cls):
317317
requires_python=">=3.8,<3.15",
318318
)
319319

320+
v25_0 = PipVersionValue(
321+
version="25.0",
322+
# N.B.: The setuptools 75.8.0 release was available on 1/026/2025 (the Pip 25.0 release
323+
# date) but 75.3.0 is the last setuptools version to support 3.8.
324+
setuptools_version="75.3.0",
325+
wheel_version="0.45.1",
326+
requires_python=">=3.8,<3.15",
327+
)
328+
320329
VENDORED = v20_3_4_patched
321330
LATEST = LatestPipVersion()
322331
DEFAULT = DefaultPipVersion(preferred=(VENDORED, v23_2, v24_1))

‎pex/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright 2015 Pex project contributors.
22
# Licensed under the Apache License, Version 2.0 (see LICENSE).
33

4-
__version__ = "2.31.0"
4+
__version__ = "2.32.0"

‎tests/integration/test_issue_1560.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ def test_build_isolation(
5151
touch(os.path.join(project_dir, "foo.py"))
5252

5353
python, pip = venv_factory.create_venv()
54+
# N.B.: Pip 25.0 introduces a new message to check for here.
5455
run_pex_command(args=[project_dir, "--no-build-isolation"], python=python).assert_failure(
55-
expected_error_re=r".*ModuleNotFoundError: No module named 'flit_core'.*",
56+
expected_error_re=r".*(?:{old_message}|{new_message}).*".format(
57+
old_message=re.escape("ModuleNotFoundError: No module named 'flit_core'"),
58+
new_message=re.escape("BackendUnavailable: Cannot import 'flit_core.buildapi'"),
59+
),
5660
re_flags=re.DOTALL,
5761
)
5862

‎tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ setenv =
8181
pip24_2: _PEX_PIP_VERSION=24.2
8282
pip24_3: _PEX_PIP_VERSION=24.3
8383
pip24_3_1: _PEX_PIP_VERSION=24.3.1
84+
pip25_0: _PEX_PIP_VERSION=25.0
8485
py314: _PEX_REQUIRES_PYTHON=>=2.7,<3.15,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*
8586

8687
# Python 3 (until a fix here in 3.9: https://bugs.python.org/issue13601) switched from stderr

0 commit comments

Comments
 (0)
Please sign in to comment.