ci(python): one Python (3.14) for the lock, a clone and the ci image
Build / build (pull_request) Successful in 14s
Molecule / molecule (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 56s

.python-version (3.14) is the source. dev-setup.sh and lock-requirements.sh
require exactly that minor; the ci image builds /opt/venv from its baked
python-build-standalone of that version (ARG PYTHON_VERSION) instead of the
distribution's python3, and derives the python<MINOR> links for
ansible-test from it; `check_image_versions.py pins` fails when
.python-version, the lock header or an `ARG PYTHON_VERSION` differs.
The lock already carries the 3.14 header (Renovate's -full container runs
pip-compile on its own python 3.14.8); renovate.yml now says that python's
minor version must equal .python-version. ci image 0.2.25 -> 0.2.26.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
This commit is contained in:
Defame1297andClaude Sonnet 5.5 committed 2026-11-16 07:42:45 +00:00
1 parent 3a777ac015
commit b0607a39e2
12 files changed
+285 -43

No files matched your search

+21 -15
View File
@@ -3,11 +3,11 @@
# (requirements-dev.lock, the hashed lock of requirements-dev.txt: the versions CI runs), the pinned collections the roles call
# (requirements.yml) and git hooks that find the tools.
#
# scripts/dev-setup.sh # KAMINO_PYTHON=python3.13 scripts/dev-setup.sh to pick one
# scripts/dev-setup.sh # KAMINO_PYTHON=/path/to/python3.13 scripts/dev-setup.sh to pick one
#
# KAMINO_PYTHON (default python3) selects the interpreter that is checked and that creates
# a new virtualenv. An existing virtualenv is kept when it already runs Python 3.13+, even
# if it was built by another interpreter; only an older one is rebuilt.
# The interpreter must be the Python of .python-version (python<MINOR> by default, KAMINO_PYTHON selects
# another path); it creates a new virtualenv. An existing virtualenv is kept when it runs that Python,
# even if another interpreter built it; one on a different Python is rebuilt.
#
# The repository is the one this script lives in, whatever the caller's working directory.
#
@@ -24,17 +24,6 @@
# idempotent; run it again after changing requirements-dev.txt or its lock, requirements.yml or the hook types.
set -euo pipefail
# ansible-core 2.22 (requirements-dev.txt) needs Python 3.13+. Renovate raises that pin, so
# when a bump of it changes the minimum Python, raise py_ok and the message below in the
# same pull request. The ci image has python3.13 next to the distribution's;
# without a system 3.13, `uv python install 3.13` provides one.
python="${KAMINO_PYTHON:-python3}"
py_ok='import sys; sys.exit(0 if sys.version_info >= (3, 13) else 1)'
if ! "$python" -c "$py_ok" 2>/dev/null; then
echo "error: $python is missing or older than 3.13 (ansible-core 2.22 needs 3.13+); set KAMINO_PYTHON=/path/to/python3.13 (uv python install 3.13)" >&2
exit 1
fi
# The repository is derived from this script's own location (symlinks resolved), never
# from the caller's working directory: running it from another repository must not
# create or remove that repository's .venv.
@@ -42,6 +31,23 @@ script="$(readlink -f "${BASH_SOURCE[0]}")"
root="$(git -C "$(dirname "$script")/.." rev-parse --show-toplevel)"
cd "$root"
# The Python of the virtualenv is the one in .python-version (a minor version, e.g. 3.13): the one the
# lock was resolved on and the ci image's /opt/venv runs on (check_image_versions.py pins keeps the lock
# header and the image's Dockerfile equal to it). ansible-core 2.22 needs 3.13+; when a Renovate bump
# raises that minimum, .python-version, the ci image's PYTHON_VERSION and the lock move in one pull request.
[ -f .python-version ] || { echo "error: .python-version is missing (the Python of the lock, a clone and the ci image)" >&2; exit 1; }
pin="$(tr -d '[:space:]' < .python-version)"
case "$pin" in
[0-9].[0-9]|[0-9].[0-9][0-9]) ;;
*) echo "error: .python-version must hold one MAJOR.MINOR version, found '$pin'" >&2; exit 1 ;;
esac
python="${KAMINO_PYTHON:-python$pin}"
py_ok="import sys; sys.exit(0 if '%d.%d' % sys.version_info[:2] == '$pin' else 1)"
if ! "$python" -c "$py_ok" 2>/dev/null; then
echo "error: $python is missing or is not Python $pin (.python-version); set KAMINO_PYTHON=/path/to/python$pin (uv python install $pin)" >&2
exit 1
fi
# `pre-commit install` refuses to run when core.hooksPath is set, and git would not run
# .git/hooks anyway. A repo-local setting whose values all resolve to this repository's own
# hooks directory (or are empty) is harmless: it is lifted for the install and restored