CI: use Python from uv's virtualenv

uv allows "uv python install" to a ~/.local, but doesn't allow
"uv pip install --user", only "--system". According to [1], we are
supposed to use a virtualenv, and make sure that "$VIRTUAL_ENV/bin"
is in "$PATH" (before "/bin").  Use ~/.local; there should be no
collisions in practice.

This fixes the problem worked around by fe3c42af9e (Work around
github actions python failure, 2026-02-08). Revert that.
Update lock files with:

	updatecli apply --config updatecli.d/python.yml
	uv lock --upgrade --exclude-newer="$(awk -F'"' <uv.lock '/^exclude-newer[[:space:]]*=/ {print $2}')"

[1]: https://github.com/astral-sh/uv/issues/2077#issuecomment-1971579880
This commit is contained in:
Johannes Altmanninger
2026-05-30 14:08:58 +08:00
parent cb983e5fb7
commit ccfbfe9965
4 changed files with 7 additions and 37 deletions

View File

@@ -13,11 +13,9 @@ runs:
command -v uv
command -v uvx
# Check that pyproject.toml and the lock file are in sync.
# TODO Use "uv" to install Python as well.
: 'Note that --no-managed-python below would be implied but be explicit'
uv='env UV_PYTHON=python uv --no-managed-python'
$uv lock --check --exclude-newer="$(awk -F'"' <uv.lock '/^exclude-newer[[:space:]]*=/ {print $2}')"
# Install globally.
sudo $uv pip install --group=dev --system --break-system-packages
uv lock --check --exclude-newer="$(awk -F'"' <uv.lock '/^exclude-newer[[:space:]]*=/ {print $2}')"
uv venv ~/.local --allow-existing
uv pip install --group=dev
# Smoke test.
python -c 'import sphinx; import sphinx_markdown_builder'
python3 -c 'import sphinx; import sphinx_markdown_builder'