From 1eabff56927185bf58683026b3db325ff9a77d1b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 13 May 2024 23:45:16 -0400 Subject: [PATCH] feat: add uv to most images Signed-off-by: Henry Schreiner --- .github/workflows/update-dependencies.yml | 9 ++++++--- README.rst | 13 ++++++++++++- docker/build_scripts/finalize.sh | 4 +++- docker/build_scripts/requirements-tools/uv | 20 ++++++++++++++++++++ noxfile.py | 18 ++++++++++++++---- requirements-tools.in | 1 + tools/update_interpreters_download.py | 6 ++++++ tools/update_native_dependencies.py | 6 ++++++ 8 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 docker/build_scripts/requirements-tools/uv diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 7814fe466..72071fa46 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -8,6 +8,9 @@ on: schedule: - cron: '0 18 * * 0' # "At 18:00 on Sunday." +env: + FORCE_COLOR: '1' + jobs: update-dependencies: name: Update dependencies @@ -30,13 +33,13 @@ jobs: app_id: ${{ secrets.MANYLINUX_BOT_APP_ID }} private_key: ${{ secrets.MANYLINUX_BOT_APP_PRIVATE_KEY }} - name: "Run update native dependencies" - run: nox --force-color --error-on-missing-interpreters -s update_native_dependencies + run: nox -s update_native_dependencies env: GITHUB_API_TOKEN: ${{ steps.generate-token.outputs.token || github.token }} - name: "Run update downloaded interpreters" - run: nox --force-color --error-on-missing-interpreters -s update_interpreters_download + run: nox -s update_interpreters_download - name: "Run update python dependencies" - run: nox --force-color --error-on-missing-interpreters -s update_python_dependencies + run: nox -s update_python_dependencies - name: Create Pull Request if: github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux' uses: peter-evans/create-pull-request@v5 diff --git a/README.rst b/README.rst index 84e814562..1b98df98a 100644 --- a/README.rst +++ b/README.rst @@ -210,7 +210,18 @@ All images currently contain: - Development packages for all the libraries that PEP 571/599 list. One should not assume the presence of any other development package. -- The `auditwheel `_ tool +- The following development tools, installed via `pipx `_ (which is also available): + - `auditwheel `_ + - `cmake `_ + - `patchelf `_ + - `swig `_ + - `uv `_ (not available on ``musllinux s390x`` and ``muslllinux powerpc64le`` yet due to Rust limitations) + +- All Python interpreters have the following packages pre-installed: + - `pip `_ + - `build `_ + - `packaging `_ + - Before Python 3.12, `setuptools `_ and `wheel `_ are also available. (Currently 3.12 too, but will be removed after 3.13 is released.) - The manylinux-interpreters tool which allows to list all available interpreters & install ones missing from the image diff --git a/docker/build_scripts/finalize.sh b/docker/build_scripts/finalize.sh index df0509892..08b7a5921 100755 --- a/docker/build_scripts/finalize.sh +++ b/docker/build_scripts/finalize.sh @@ -79,7 +79,9 @@ pipx uninstall pip # install other tools with pipx for TOOL_PATH in $(find ${MY_DIR}/requirements-tools -type f); do TOOL=$(basename ${TOOL_PATH}) - pipx install --pip-args="--require-hashes -r ${TOOL_PATH} --only-binary" ${TOOL} + if [[ "$TOOL" != "uv" || "$AUDITWHEEL_POLICY" != musllinux* || ("$AUDITWHEEL_ARCH" != "s390x" && "$AUDITWHEEL_ARCH" != "powerpc64le") ]]; then + pipx install --pip-args="--require-hashes -r ${TOOL_PATH} --only-binary" ${TOOL} + fi done # We do not need the precompiled .pyc and .pyo files. diff --git a/docker/build_scripts/requirements-tools/uv b/docker/build_scripts/requirements-tools/uv new file mode 100644 index 000000000..0c691339d --- /dev/null +++ b/docker/build_scripts/requirements-tools/uv @@ -0,0 +1,20 @@ +# This file was autogenerated by uv via the following command: +# nox -s update_python_dependencies +uv==0.1.43 \ + --hash=sha256:04c5b815d5d679b962249c1e03606ab78163ba7eea0ba2b47bcfc9b2f19abfba \ + --hash=sha256:177044b9002da3c278002d51fad8e6e730a6ed39a2b0cde4f4a66326698811f9 \ + --hash=sha256:1d5fc94e8c1308213ce0909f69f4683bd1daaad08c451cadd4fe1a656fd7e119 \ + --hash=sha256:326232a9750945192018f0b74ad7450cec2309a00dbee7291cf5cabc1665980e \ + --hash=sha256:4be5a9fe315340f10900df29029b29fa75eb0722e3052a937991c35aa3af0869 \ + --hash=sha256:537439f955e361e0d2113710ae5339fd7cb0cefb7274f7ed33351248ab22c254 \ + --hash=sha256:58446aadbae300c92300ba6686c5f802a647478d894efc5725315a947d62345e \ + --hash=sha256:99f9ee893a597374630df23a873e2888ad333e1d31bdca103914c2236ce77ed7 \ + --hash=sha256:a4e4f86afbf5949da8a1eb376327866158bcfda3a92d25e74b0ce9988d7bf477 \ + --hash=sha256:a5f16230631d4fd2d0b98a89759b256bdf647c3e7641b39e9632652137b3f901 \ + --hash=sha256:a8c0447cdd2c54b58c33ad06305812e918c0bc5695370a60c12cc0045dcc5b32 \ + --hash=sha256:b5365c163cdbc50bc97ebe2607357241cecb2d6c8e05916b4a495a0089a9e311 \ + --hash=sha256:bd06f50cbbc1536d679aa1366011af04c7b613e84396e917bb0014a4b5de8e47 \ + --hash=sha256:d2d3f592543aa9dd3bf59c5cfe2479d05fa07690449ddf94e225cd6d1567c743 \ + --hash=sha256:e198f64dfc85d55cf8861a4a57aa6fbafe8f969261f6bceb400e4ac1ca595428 \ + --hash=sha256:f495da8017453d5b185f6d2b3d57c6a60e063136aaa6e8bf92164bb3573cab45 \ + --hash=sha256:f54666b392ca0db4d4b6a23aceb1fba1e7329dc1e2882a252afe407034de316c diff --git a/noxfile.py b/noxfile.py index b0e4c0be8..8e136ff85 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,9 +4,13 @@ import nox +nox.needs_version = ">=2024.4.15" +nox.options.default_venv_backend = "uv|virtualenv" + @nox.session def update_python_dependencies(session): + "Update the base and per-python dependencies lockfiles" if getattr(session.virtualenv, "venv_backend", "") != "uv": session.install("uv>=0.1.23") @@ -60,11 +64,17 @@ def update_python_dependencies(session): @nox.session(python="3.11", reuse_venv=True) def update_native_dependencies(session): - session.install("lastversion>=3.5.0", "packaging", "requests") - session.run("python", "tools/update_native_dependencies.py", *session.posargs) + "Update the native dependencies" + script = "tools/update_native_dependencies.py" + deps = nox.project.load_toml(script)["dependencies"] + session.install(*deps) + session.run("python", script, *session.posargs) @nox.session(python="3.11", reuse_venv=True) def update_interpreters_download(session): - session.install("packaging", "requests") - session.run("python", "tools/update_interpreters_download.py", *session.posargs) + "Update all the Python interpreters" + script = "tools/update_interpreters_download.py" + deps = nox.project.load_toml(script)["dependencies"] + session.install(*deps) + session.run("python", script, *session.posargs) diff --git a/requirements-tools.in b/requirements-tools.in index 5a11bef3b..cb04eb9c0 100644 --- a/requirements-tools.in +++ b/requirements-tools.in @@ -2,3 +2,4 @@ auditwheel cmake patchelf swig +uv diff --git a/tools/update_interpreters_download.py b/tools/update_interpreters_download.py index 094653e41..5e04662d4 100644 --- a/tools/update_interpreters_download.py +++ b/tools/update_interpreters_download.py @@ -1,3 +1,9 @@ +#!/usr/bin/env python + +# /// script +# dependencies = ["packaging", "requests"] +# /// + from __future__ import annotations import argparse diff --git a/tools/update_native_dependencies.py b/tools/update_native_dependencies.py index 74afc8e6a..d342a269d 100644 --- a/tools/update_native_dependencies.py +++ b/tools/update_native_dependencies.py @@ -1,3 +1,9 @@ +#!/usr/bin/env python + +# /// script +# dependencies = ["lastversion>=3.5.0", "packaging", "requests"] +# /// + import argparse import hashlib import re