Skip to content
Python

setup_dev_env.sh: list the interpreters checked when none is new enough

Rohit C Prasad2e5e86d068c9
diff --git a/packaging/setup_dev_env.sh b/packaging/setup_dev_env.sh
index 847e5c45..48d44cb4 100644
--- a/packaging/setup_dev_env.sh
+++ b/packaging/setup_dev_env.sh
@@ -10,24 +10,32 @@ set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
VENV="$ROOT/.venv"
-# Find a Python >= 3.10 (macOS system python3 is often 3.9 and too old)
+# Pick the newest Python >= 3.10 on PATH. The python3 that ships with macOS
+# (and some Linux images) can be older than that, so try the versioned names
+# first and fall back to bare python3.
PYTHON=""
-for candidate in python3.13 python3.12 python3.11 python3.10 python3; do
- if command -v "$candidate" &>/dev/null; then
- version=$("$candidate" -c 'import sys; print(sys.version_info >= (3,10))')
- if [ "$version" = "True" ]; then
- PYTHON="$candidate"
- break
- fi
+found=()
+probe='import sys; print("%d.%d.%d" % sys.version_info[:3]); sys.exit(0 if sys.version_info >= (3, 10) else 1)'
+for candidate in python3.14 python3.13 python3.12 python3.11 python3.10 python3; do
+ path="$(command -v "$candidate" 2>/dev/null)" || continue
+ if version="$("$path" -c "$probe" 2>/dev/null)"; then
+ PYTHON="$path"
+ break
fi
+ found+=("$path (${version:-not runnable})")
done
if [ -z "$PYTHON" ]; then
- echo "Error: Python 3.10+ is required but not found." >&2
- echo "Install it via: brew install [email protected] (macOS) or your system package manager." >&2
+ echo "Error: Python 3.10 or newer is required, but none was found on PATH." >&2
+ if [ "${#found[@]}" -gt 0 ]; then
+ echo "Checked:" >&2
+ printf ' %s\n' "${found[@]}" >&2
+ fi
+ echo "Install one (macOS: brew install [email protected]) or add it to PATH, then rerun." >&2
exit 1
fi
+echo "Using $PYTHON ($version)"
"$PYTHON" -m venv "$VENV"
# The coworker package (server, engine, connectors) + inbound-messaging extras.
# aisuite comes in as a regular dependency (git-pinned in pyproject.toml until