Files
computer-playbook/scripts/install/python.sh
T
kevinveenbirkenbach 98e1f39291 fix(install): add retry logic for pip installs in python setup script
Add retry wrapper (7 attempts, 20s delay) around pip install
commands to mitigate transient network errors (e.g. GitHub 403,
rate limits, temporary connectivity issues) during CI builds.

https://chatgpt.com/share/e/69933fb2-9c94-8013-815d-4f9509b0456f
2026-02-16 17:03:18 +01:00

44 lines
846 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
: "${PYTHON:?PYTHON not set}"
EXTRA="${1:-}"
retry() {
local attempts=7
local delay=20
local count=1
while true; do
if "$@"; then
return 0
fi
if [[ $count -ge $attempts ]]; then
echo "❌ Command failed after ${attempts} attempts."
return 1
fi
echo "⚠️ Attempt ${count}/${attempts} failed. Retrying in ${delay}s..."
sleep "${delay}"
((count++))
done
}
install_python_deps() {
echo "📦 Installing Python dependencies"
retry "${PYTHON}" -m pip install --upgrade pip setuptools wheel
if [[ -n "${EXTRA}" ]]; then
echo "→ Installing with extras: [${EXTRA}]"
retry "${PYTHON}" -m pip install -e ".[${EXTRA}]"
else
echo "→ Installing base package"
retry "${PYTHON}" -m pip install -e .
fi
}
install_python_deps