Use uv-managed Python for the CI jobs - #15572
Conversation
setup-python installs the python.org pkg, and that installer runs for 30-50s per job on the macOS runners. uv installs a python-build-standalone interpreter in a few seconds. The uv version comes from the constraints file, and the matrix names drop the -dev suffix because uv resolves an unreleased minor to its latest prerelease. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM
|
Timing for the macOS jobs. "Before" is the two most recent warm main runs (33562151532 and the re-run of 33588967176); "after" is this PR's run (33589841415). The setup step is the direct effect; the build and test steps are unchanged by this PR and vary ±10s run to run.
3.14 was already fast because that version is preinstalled in the runner image's toolcache; every other version paid for the pkg installer. Summed over the five jobs the setup step goes from about 170s to about 24s per run. The 3.15 / 3.15t caches were cold in this run because their key changed (matrix name and resolved version), so their build and total numbers will settle on the next run. Generated by Claude Code |
alex
left a comment
There was a problem hiding this comment.
@reaperhulk let's chat about this one
| - {VERSION: "3.15", NOXSESSION: "tests"} | ||
| - {VERSION: "3.15t", NOXSESSION: "tests"} |
There was a problem hiding this comment.
-dev isn't required for pre-releases?
There was a problem hiding this comment.
Right: uv has no -dev spelling (3.15-dev is rejected as an executable name), and a bare minor resolves to the latest prerelease when no stable release exists. Checked with the pinned uv 0.12.8: uv python install 3.15 gives cpython-3.15.0rc1, 3.15t gives cpython-3.15.0rc1+freethreaded, 3.14t gives 3.14.7+freethreaded. The run on this PR used those.
Generated by Claude Code
| cache-dependency-glob: ci-constraints-requirements.txt | ||
| timeout-minutes: 3 | ||
| - id: python-version | ||
| run: echo "version=$(python -c 'import platform; print(platform.python_version())')" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
@woodruffw can you give us this as an output :-) Surely setup-uv already has this value internally
There was a problem hiding this comment.
Yeah, I can look into this. I thought we did have this as a version output.
There was a problem hiding this comment.
In case it helps: in v10.0.1 the python-version output is the input string echoed back (getPythonVersion in src/setup-uv.ts returns inputs.pythonVersion when set), so 3.15t comes out as 3.15t rather than 3.15.0rc1. uv python find --show-version after the venv is created would give the resolved value.
Generated by Claude Code
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM
|
Notes:
|
The windows arm64 job stays on setup-python: uv has no Windows arm64 interpreters. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM
|
Extended to the linux, windows x64 and downstream jobs (c4c8e9f, plus 6932c44 which puts the interpreter's Setup step times, last warm main run (33588967176) versus this head (33695131695); for Windows the whole
Linux was already fast because the runner image preinstalls those versions; macOS and Windows x64 are where the time was. Generated by Claude Code |
uv does ship Windows arm64 interpreters; they just don't appear in `uv python list --all-platforms`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM
Left to a bare version request, uv on Windows arm64 downloads the x86_64 build, and maturin then targets x86_64-pc-windows-msvc. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM
actions/setup-pythonon macOS downloads the python.org pkg and runs the installer, and the "Install Python binaries from prebuilt package" step takes 30–50s per job. On Windows the download and extraction is similarly the slowest part of the job.astral-sh/setup-uvinstalls a python-build-standalone interpreter in a few seconds.Applies to every job that used
actions/setup-pythoninci.yml: linux, macOS, windows (x64 and arm64) and downstream.ci-constraints-requirements.txtviaversion-file, so it stays in lockstep with the pinneduv==that dependabot bumps.activate-environmentputs a venv on that interpreter first onPATH; nox is installed into it withuv pip install.3.15/3.15t(uv resolves an unreleased minor to its latest prerelease) andpypy3.11. The cargo cache key uses the resolved version, read from the interpreter, as before.LIBDIRonLD_LIBRARY_PATHfor the rust session, whosecargo testbinaries link libpython.The trade-off is that these jobs no longer exercise the python.org framework build on macOS; the wheel builder still installs and uses the python.org pkg.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QZZQDQuPPD8T7jaAsCSHtM