From 20930710e43b8af4c60eb2623611d5368a4e0514 Mon Sep 17 00:00:00 2001 From: Jiahui Chen Date: Tue, 17 Nov 2026 12:20:32 -0700 Subject: [PATCH] setup_env.sh: report the venv's Python when reusing a venv (#53) The script printed the interpreter discovery picked, then reused an existing .venv built by a different one, so 'python: 3.10' could sit above a test run on 3.11. Reusing a venv now names the venv's own version and warns when it differs, and the test step names the interpreter it runs on. Co-Authored-By: Claude Opus 5.5 --- scripts/setup_env.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/setup_env.sh b/scripts/setup_env.sh index bc6fb0f..6ac7903 100755 --- a/scripts/setup_env.sh +++ b/scripts/setup_env.sh @@ -43,7 +43,13 @@ if [ ! -d "$VENV" ]; then "$PY" -m venv "$VENV" echo "created $VENV" else - echo "reusing $VENV" + # Report the venv's own interpreter: it is the one that runs everything below, and + # it need not be the one discovery picked (#53). + have=$("$VENV/bin/python" -V 2>&1) + echo "reusing $VENV ($have)" + if [ "$have" != "$("$PY" -V 2>&1)" ]; then + echo " note: differs from discovered $("$PY" -V 2>&1); delete .venv to rebuild with it" >&2 + fi fi # shellcheck disable=SC1091 source "$VENV/bin/activate" @@ -81,6 +87,7 @@ print("imports ok") PYCHECK # --- tests ------------------------------------------------------------------ +echo "testing with $(python -V 2>&1) ($(command -v python))" python -m pytest -q # --- what can actually annotate ---------------------------------------------