From e9dd4eb03b38d818ca31c5d89762ae4faa66e98e Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Fri, 22 Aug 2025 11:03:00 -0700 Subject: [PATCH] stop running setup.py and switch to python -m build (#10442) fixes #10404 unfortunately, exactly what `python setup.py clean` did doesn't seem well documented so i dug into the code with a debugger. executing the `clean` subcommand is done by [this code](https://github.com/pypa/setuptools/blob/9cc2f5c05c333cd4cecd2c0d9e7c5e208f2a3148/setuptools/_distutils/command/clean.py#L54-L77) where the relevant build variables are set by the `build` subcommand [here](https://github.com/pypa/setuptools/blob/9cc2f5c05c333cd4cecd2c0d9e7c5e208f2a3148/setuptools/_distutils/command/build.py#L52) and [here](https://github.com/pypa/setuptools/blob/9cc2f5c05c333cd4cecd2c0d9e7c5e208f2a3148/setuptools/_distutils/command/build.py#L112). it turns out us running `python setup.py clean` was already redundant with `rm -rf build` on the next line i built two releases, one on the latest commit in this PR and another on https://github.com/certbot/certbot/commit/44f1dd677b75da27f12374fd34d68306ae6f615c before the switch to `python -m build`. a simple diff of the resulting tarballs and wheels fails, presumably because of metadata differences, but after untaring or unzipping the files, the contents are identical for all of our built packages --- certbot/pyproject.toml | 1 + tools/_release.sh | 8 ++++---- tools/requirements.txt | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/certbot/pyproject.toml b/certbot/pyproject.toml index 503a9b9f8..3e7946e97 100644 --- a/certbot/pyproject.toml +++ b/certbot/pyproject.toml @@ -35,6 +35,7 @@ classifiers = [ [project.optional-dependencies] dev = [ "azure-devops", + "build", "ipdb", # allows us to use newer urllib3 https://github.com/python-poetry/poetry-plugin-export/issues/183 "poetry-plugin-export>=1.9.0", diff --git a/tools/_release.sh b/tools/_release.sh index 55fa15b35..730dd77e8 100755 --- a/tools/_release.sh +++ b/tools/_release.sh @@ -82,7 +82,7 @@ tmpvenv=$(mktemp -d) python3 -m venv "$tmpvenv" . $tmpvenv/bin/activate # update packaging tools to their pinned versions -tools/pip_install.py towncrier virtualenv +tools/pip_install.py build towncrier uv virtualenv root_without_le="$version.$$" root="$RELEASE_DIR/le.$root_without_le" @@ -133,10 +133,10 @@ for pkg_dir in $SUBPKGS do cd $pkg_dir - python setup.py clean rm -rf build dist - python setup.py sdist - python setup.py bdist_wheel + # It's not strictly necessary, but using uv to install build dependencies speeds things up a + # little bit. + python -m build --installer uv cd - done diff --git a/tools/requirements.txt b/tools/requirements.txt index 5a96e9d63..72189f97b 100644 --- a/tools/requirements.txt +++ b/tools/requirements.txt @@ -17,8 +17,8 @@ babel==2.17.0 ; python_version >= "3.10" and python_version < "4.0" backports-tarfile==1.2.0 ; python_version >= "3.10" and python_version < "3.12" bcrypt==4.3.0 ; python_version >= "3.10" and python_version < "4.0" beautifulsoup4==4.13.4 ; python_version >= "3.10" and python_version < "4.0" -boto3==1.40.11 ; python_version >= "3.10" and python_version < "4.0" -botocore==1.40.11 ; python_version >= "3.10" and python_version < "4.0" +boto3==1.40.15 ; python_version >= "3.10" and python_version < "4.0" +botocore==1.40.15 ; python_version >= "3.10" and python_version < "4.0" build==1.3.0 ; python_version >= "3.10" and python_version < "4.0" cachecontrol==0.14.3 ; python_version >= "3.10" and python_version < "4.0" cachetools==5.5.2 ; python_version >= "3.10" and python_version < "4.0" @@ -76,7 +76,7 @@ isodate==0.7.2 ; python_version >= "3.10" and python_version < "4.0" isort==5.13.2 ; python_version >= "3.10" and python_version < "4.0" jaraco-classes==3.4.0 ; python_version >= "3.10" and python_version < "4.0" jaraco-context==6.0.1 ; python_version >= "3.10" and python_version < "4.0" -jaraco-functools==4.2.1 ; python_version >= "3.10" and python_version < "4.0" +jaraco-functools==4.3.0 ; python_version >= "3.10" and python_version < "4.0" jedi==0.19.2 ; python_version >= "3.10" and python_version < "4.0" jeepney==0.9.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux" jinja2==3.1.6 ; python_version >= "3.10" and python_version < "4.0" @@ -101,7 +101,7 @@ packaging==25.0 ; python_version >= "3.10" and python_version < "4.0" paramiko==4.0.0 ; python_version >= "3.10" and python_version < "4.0" parsedatetime==2.6 ; python_version >= "3.10" and python_version < "4.0" parso==0.8.4 ; python_version >= "3.10" and python_version < "4.0" -pbs-installer==2025.8.14 ; python_version >= "3.10" and python_version < "4.0" +pbs-installer==2025.8.18 ; python_version >= "3.10" and python_version < "4.0" pexpect==4.9.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "win32" and sys_platform != "emscripten" pip==25.2 ; python_version >= "3.10" and python_version < "4.0" pkginfo==1.12.1.2 ; python_version >= "3.10" and python_version < "4.0" @@ -142,12 +142,12 @@ readme-renderer==44.0 ; python_version >= "3.10" and python_version < "4.0" requests-file==2.1.0 ; python_version >= "3.10" and python_version < "4.0" requests-oauthlib==2.0.0 ; python_version >= "3.10" and python_version < "4.0" requests-toolbelt==1.0.0 ; python_version >= "3.10" and python_version < "4.0" -requests==2.32.4 ; python_version >= "3.10" and python_version < "4.0" +requests==2.32.5 ; python_version >= "3.10" and python_version < "4.0" rfc3986==2.0.0 ; python_version >= "3.10" and python_version < "4.0" rich==14.1.0 ; python_version >= "3.10" and python_version < "4.0" roman-numerals-py==3.1.0 ; python_version >= "3.11" and python_version < "4.0" rsa==4.9.1 ; python_version >= "3.10" and python_version < "4.0" -ruff==0.12.9 ; python_version >= "3.10" and python_version < "4.0" +ruff==0.12.10 ; python_version >= "3.10" and python_version < "4.0" s3transfer==0.13.1 ; python_version >= "3.10" and python_version < "4.0" secretstorage==3.3.3 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux" semantic-version==2.10.0 ; python_version >= "3.10" and python_version < "4.0" @@ -179,14 +179,14 @@ trove-classifiers==2025.8.6.13 ; python_version >= "3.10" and python_version < " twine==6.1.0 ; python_version >= "3.10" and python_version < "4.0" types-httplib2==0.22.0.20250622 ; python_version >= "3.10" and python_version < "4.0" types-pyrfc3339==2.0.1.20241107 ; python_version >= "3.10" and python_version < "4.0" -types-python-dateutil==2.9.0.20250809 ; python_version >= "3.10" and python_version < "4.0" -types-pywin32==311.0.0.20250809 ; python_version >= "3.10" and python_version < "4.0" +types-python-dateutil==2.9.0.20250822 ; python_version >= "3.10" and python_version < "4.0" +types-pywin32==311.0.0.20250822 ; python_version >= "3.10" and python_version < "4.0" types-requests==2.32.4.20250809 ; python_version >= "3.10" and python_version < "4.0" -types-setuptools==80.9.0.20250809 ; python_version >= "3.10" and python_version < "4.0" +types-setuptools==80.9.0.20250822 ; python_version >= "3.10" and python_version < "4.0" typing-extensions==4.14.1 ; python_version >= "3.10" and python_version < "4.0" uritemplate==4.2.0 ; python_version >= "3.10" and python_version < "4.0" urllib3==2.5.0 ; python_version >= "3.10" and python_version < "4.0" -uv==0.8.11 ; python_version >= "3.10" and python_version < "4.0" +uv==0.8.13 ; python_version >= "3.10" and python_version < "4.0" virtualenv==20.32.0 ; python_version >= "3.10" and python_version < "4.0" wcwidth==0.2.13 ; python_version >= "3.10" and python_version < "4.0" wheel==0.45.1 ; python_version >= "3.10" and python_version < "4.0"