#!/usr/bin/env bash # dev-setup.sh - create a reproducible development environment (pyenv + venv) # Usage: ./dev-setup.sh [python-version] set -euo pipefail PYTHON_VERSION=${1:-3.11.4} echo "Using python version: ${PYTHON_VERSION}" if ! command -v pyenv >/dev/null 2>&1; then echo "pyenv not found. Install via Homebrew: brew install pyenv" exit 1 fi pyenv install -s "${PYTHON_VERSION}" pyenv local "${PYTHON_VERSION}" # Recreate venv rm -rf venv pyenv exec python -m venv venv # Activate and install # shellcheck source=/dev/null source venv/bin/activate python -m pip install --upgrade pip setuptools wheel python -m pip install -r requirements.txt if [ -f dev-requirements.txt ]; then python -m pip install -r dev-requirements.txt fi echo "Development environment ready. Activate with: source venv/bin/activate"