Spaces:
Sleeping
Sleeping
File size: 829 Bytes
29c3655 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#!/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"
|