From 1815c66a53f7dc5d662494aeb990792e1157f407 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Wed, 21 May 2025 10:55:35 -0400 Subject: [PATCH 1/7] Restrict dependencies; improve CI reproducibility `click` v8.2 needs to be handled -- as a follow-up change -- but it's hard to know if the application itself will work with it yet. Instead of restricting that in tox.ini, I have chosen to restrict it in the metadata itself. `setuptools` on newer versions breaks some of the tests, but restricting it for package metadata is definitely wrong. Therefore, it is only restricted for now on the `pipsupported` build. This should lead to improved CI, but will not result in all tests passing. --- pyproject.toml | 2 +- tox.ini | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ac3e04ee1..631d812ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ keywords = ["pip", "requirements", "packaging"] dependencies = [ # direct dependencies "build >= 1.0.0", - "click >= 8", + "click >= 8 , < 8.2", "pip >= 22.2", "pyproject_hooks", "tomli; python_version < '3.11'", diff --git a/tox.ini b/tox.ini index 85f3dc685..41baa4dca 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,8 @@ extras = coverage: coverage deps = pipsupported: pip==24.2 + pipsupported: setuptools<=75.8.2 + piplowest: pip==22.2.* piplatest: pip pipmain: https://github.com/pypa/pip/archive/main.zip From 7f9957c5c74b7303accd833db24c138e2e137953 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Mon, 26 May 2025 19:02:23 -0400 Subject: [PATCH 2/7] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- pyproject.toml | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 631d812ef..9bea9f8eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ keywords = ["pip", "requirements", "packaging"] dependencies = [ # direct dependencies "build >= 1.0.0", - "click >= 8 , < 8.2", + "click >= 8, < 8.2", "pip >= 22.2", "pyproject_hooks", "tomli; python_version < '3.11'", diff --git a/tox.ini b/tox.ini index 41baa4dca..cb362e01c 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ extras = coverage: coverage deps = pipsupported: pip==24.2 - pipsupported: setuptools<=75.8.2 + pipsupported: setuptools <= 75.8.2 piplowest: pip==22.2.* piplatest: pip From c8fb33a4433ad5cd3d455c57fec43ad89cbce1bf Mon Sep 17 00:00:00 2001 From: Andy Kluger Date: Fri, 23 May 2025 23:05:51 -0400 Subject: [PATCH 3/7] Accept complaint of any missing key in a known invalid pyproject.toml The stderr may stop after noting the missing version, without mentioning the missing name --- tests/test_cli_compile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py index 2c939ab0f..afc9c8776 100644 --- a/tests/test_cli_compile.py +++ b/tests/test_cli_compile.py @@ -3,6 +3,7 @@ import hashlib import os import pathlib +import re import shutil import subprocess import sys @@ -2664,7 +2665,7 @@ def test_error_in_pyproject_toml( captured = capfd.readouterr() assert ( - "`project` must contain ['name'] properties" in captured.err + bool(re.search(r"`project` must contain \['[^']+'\] properties", captured.err)) ) is verbose_option From ac84d4c702dd0553e839cc3e0a1c73d836c78a05 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Fri, 13 Jun 2025 11:53:59 -0500 Subject: [PATCH 4/7] Add support for Python 3.12 and test on 3.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add 3.12 to CI - Update a test which fails on 3.12 due to changes in CPython/pip behaviors, with a comment explaining why - Update the `tox` `piplowest` build to now select `pip==23.2.*` on Python 3.12+. The lowest declared supported `pip` version (`22.2.*`) does not work on 3.12. This change builds on previous efforts by other pip-tools contributors: - https://github.com/jazzband/pip-tools/pull/2148 - https://github.com/jazzband/pip-tools/pull/2183 Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <578543+webknjaz@users.noreply.github.com> Co-authored-by: Andy Kluger <1787385+AndydeCleyre@users.noreply.github.com> --- .github/workflows/ci.yml | 1 + tests/test_sync.py | 12 +++++++++--- tox.ini | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b85873b00..f9aaa3723 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,7 @@ jobs: - Windows - macOS python-version: + - "3.12" - "3.11" - "3.10" - "3.9" diff --git a/tests/test_sync.py b/tests/test_sync.py index e84b598ba..a6b19b83e 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -168,13 +168,19 @@ def test_diff_should_not_uninstall(fake_dist): "pip-tools==1.1.1", "pip-review==1.1.1", "pkg-resources==0.0.0", - "setuptools==34.0.0", - "wheel==0.29.0", "python==3.0", - "distribute==0.1", "wsgiref==0.1", "argparse==0.1", ) + # on Python 3.12 and above, `ensurepip` and `venv` do not default to installing + # 'setuptools' -- as such, `pip` changes behavior on many Python 3.12 environments + # to use isolated builds + if sys.version_info < (3, 12): + ignored += ( + "setuptools==34.0.0", + "wheel==0.29.0", + "distribute==0.1", + ) installed = [fake_dist(pkg) for pkg in ignored] reqs = [] diff --git a/tox.ini b/tox.ini index cb362e01c..dba0b4bb2 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,9 @@ deps = pipsupported: pip==24.2 pipsupported: setuptools <= 75.8.2 - piplowest: pip==22.2.* + piplowest: pip == 22.2.* ; python_version < "3.12" + piplowest: pip == 23.2.* ; python_version >= "3.12" + piplatest: pip pipmain: https://github.com/pypa/pip/archive/main.zip setenv = From 083e36e89d6f8cffa5bf162b40845f84fdf359ce Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Mon, 16 Jun 2025 16:52:43 -0500 Subject: [PATCH 5/7] Fix stub executable in tests for Windows On Python 3.12+, `shutil.which()` will not recognize executables which do not match `PATHEXT` even when given an absolute path to an executable. As a result, this stub executable used in a test case fails to be recognized and an unexpected error is emitted. --- tests/test_cli_sync.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_cli_sync.py b/tests/test_cli_sync.py index 5e69770fe..284ad36b8 100644 --- a/tests/test_cli_sync.py +++ b/tests/test_cli_sync.py @@ -333,7 +333,12 @@ def test_invalid_pip_version_in_python_executable( with open(sync.DEFAULT_REQUIREMENTS_FILE, "w") as req_in: req_in.write("small-fake-a==1.10.0") - custom_executable = tmp_path / "custom_executable" + # a dummy executable on Windows needs to end in `.exe` in order for + # `shutil.which` to find it + executable_name = ( + "custom_executable.exe" if os.name == "nt" else "custom_executable" + ) + custom_executable = tmp_path / executable_name custom_executable.write_text("") custom_executable.chmod(0o700) From 571cbcddb2dbd66b0775db18cbef4c625986df5b Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Mon, 16 Jun 2025 17:02:46 -0500 Subject: [PATCH 6/7] Add Python 3.12 classifier Also, reorder the classifiers to be in ascending order. Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9bea9f8eb..0d5bc63bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,10 +20,11 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python", From ab7a1a3fa56d599faf30d751b81a899bcf45fead Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Thu, 19 Jun 2025 09:18:56 -0500 Subject: [PATCH 7/7] Update tests/test_cli_sync.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- tests/test_cli_sync.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_cli_sync.py b/tests/test_cli_sync.py index 284ad36b8..cebfd7081 100644 --- a/tests/test_cli_sync.py +++ b/tests/test_cli_sync.py @@ -335,10 +335,7 @@ def test_invalid_pip_version_in_python_executable( # a dummy executable on Windows needs to end in `.exe` in order for # `shutil.which` to find it - executable_name = ( - "custom_executable.exe" if os.name == "nt" else "custom_executable" - ) - custom_executable = tmp_path / executable_name + custom_executable = tmp_path / "custom_executable.exe" custom_executable.write_text("") custom_executable.chmod(0o700)