Switch CI to astral-managed Python via setup-uv#171760
Draft
bdraco wants to merge 4 commits into
Draft
Conversation
Replace actions/setup-python with astral-sh/setup-uv so every job uses the python-build-standalone interpreter astral ships, which bakes in the PEP 744 tail call interpreter on 3.14. setup-uv handles both installing uv and provisioning the requested Python version, so the venv bootstrap uses 'uv venv' instead of 'python -m venv' and there is no longer a separate uv install step on cache miss. Bumps CACHE_VERSION so the old setup-python venv caches are invalidated; the venv symlinks would otherwise point at the absent hostedtoolcache interpreter.
Mirrors esphome/esphome#16534. Without an explicit version, setup-uv fetches uv.ndjson from raw.githubusercontent.com on every cache miss, which periodically times out and fails the job. Expose the uv version from requirements.txt via the info job and pass it to every setup-uv call. Also set ignore-nothing-to-cache: true so jobs that do not touch uv (e.g. gen-copilot-instructions) no longer fail on the post-step cache save.
setup-uv only sets UV_PYTHON, it does not actually fetch the interpreter; uv installs it lazily on the first 'uv venv' or 'uv pip install'. When the venv cache hits, no uv command runs, so the cached venv's bin/python3 symlink points at an interpreter that was never installed in this job and the next step that activates the venv aborts with 'broken symlink'. Extract setup-uv plus an explicit 'uv python install' into the .github/actions/setup-uv-python composite action so every job that restores the venv ends up with a real Python at the expected path. Enable cache-python in the wrapper so subsequent jobs reuse astral's download instead of refetching it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Stacked on top of #171735. Run CI on astral's uv-managed Python, built with the PEP 744 tail call interpreter plus PGO, LTO, BOLT, and mimalloc. Setup goes through a new
.github/actions/setup-uv-pythoncomposite that pins uv, installs the interpreter eagerly, and caches it viacache-python: true. Venv bootstrap usesuv venv,CACHE_VERSIONis bumped.Saves roughly 35 min of CPU time per CI run vs the parent PR. The pytest-full matrix groups each drop 90 to 330 s; pylint drops ~100 s; hassfest drops ~16 s. DB jobs are I/O bound so individual runs swing in both directions.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: