Skip to content

Commit 8d5e46e

Browse files
authored
Merge pull request #2188 from sirosen/support-python312
Add support for Python 3.12
2 parents e4ed0c1 + ab7a1a3 commit 8d5e46e

6 files changed

Lines changed: 24 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
- Windows
5555
- macOS
5656
python-version:
57+
- "3.12"
5758
- "3.11"
5859
- "3.10"
5960
- "3.9"

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ classifiers = [
2020
"Operating System :: OS Independent",
2121
"Programming Language :: Python :: 3 :: Only",
2222
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.10",
24-
"Programming Language :: Python :: 3.11",
2523
"Programming Language :: Python :: 3.8",
2624
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
2728
"Programming Language :: Python :: Implementation :: CPython",
2829
"Programming Language :: Python :: Implementation :: PyPy",
2930
"Programming Language :: Python",
@@ -37,7 +38,7 @@ keywords = ["pip", "requirements", "packaging"]
3738
dependencies = [
3839
# direct dependencies
3940
"build >= 1.0.0",
40-
"click >= 8",
41+
"click >= 8, < 8.2",
4142
"pip >= 22.2",
4243
"pyproject_hooks",
4344
"tomli; python_version < '3.11'",

tests/test_cli_compile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import hashlib
44
import os
55
import pathlib
6+
import re
67
import shutil
78
import subprocess
89
import sys
@@ -2664,7 +2665,7 @@ def test_error_in_pyproject_toml(
26642665
captured = capfd.readouterr()
26652666

26662667
assert (
2667-
"`project` must contain ['name'] properties" in captured.err
2668+
bool(re.search(r"`project` must contain \['[^']+'\] properties", captured.err))
26682669
) is verbose_option
26692670

26702671

tests/test_cli_sync.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ def test_invalid_pip_version_in_python_executable(
333333
with open(sync.DEFAULT_REQUIREMENTS_FILE, "w") as req_in:
334334
req_in.write("small-fake-a==1.10.0")
335335

336-
custom_executable = tmp_path / "custom_executable"
336+
# a dummy executable on Windows needs to end in `.exe` in order for
337+
# `shutil.which` to find it
338+
custom_executable = tmp_path / "custom_executable.exe"
337339
custom_executable.write_text("")
338340

339341
custom_executable.chmod(0o700)

tests/test_sync.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,19 @@ def test_diff_should_not_uninstall(fake_dist):
168168
"pip-tools==1.1.1",
169169
"pip-review==1.1.1",
170170
"pkg-resources==0.0.0",
171-
"setuptools==34.0.0",
172-
"wheel==0.29.0",
173171
"python==3.0",
174-
"distribute==0.1",
175172
"wsgiref==0.1",
176173
"argparse==0.1",
177174
)
175+
# on Python 3.12 and above, `ensurepip` and `venv` do not default to installing
176+
# 'setuptools' -- as such, `pip` changes behavior on many Python 3.12 environments
177+
# to use isolated builds
178+
if sys.version_info < (3, 12):
179+
ignored += (
180+
"setuptools==34.0.0",
181+
"wheel==0.29.0",
182+
"distribute==0.1",
183+
)
178184
installed = [fake_dist(pkg) for pkg in ignored]
179185
reqs = []
180186

tox.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ extras =
1515
coverage: coverage
1616
deps =
1717
pipsupported: pip==24.2
18-
piplowest: pip==22.2.*
18+
pipsupported: setuptools <= 75.8.2
19+
20+
piplowest: pip == 22.2.* ; python_version < "3.12"
21+
piplowest: pip == 23.2.* ; python_version >= "3.12"
22+
1923
piplatest: pip
2024
pipmain: https://github.com/pypa/pip/archive/main.zip
2125
setenv =

0 commit comments

Comments
 (0)