PERDYPTO
Upload 45 files
0109502 verified
Raw History Blame Contribute Delete
2.07 kB
#!/usr/bin/env bash
# One-time setup for macOS/Linux.
#
# Creates an isolated virtual environment INSIDE this project folder
# (.venv/) and installs the pipeline's dependencies into it. This never
# touches your system Python, any other project's packages, or anything
# outside this folder — deleting the project folder removes everything
# this script installed (except Gitleaks, which is a separate one-time
# system tool; see the message at the end).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
PYTHON_BIN="${PYTHON_BIN:-python3}"
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1; then
echo "ERROR: $PYTHON_BIN not found. Install Python 3.10+ first: https://www.python.org/downloads/"
exit 1
fi
echo "Using $($PYTHON_BIN --version)"
if [ ! -d ".venv" ]; then
echo "Creating isolated virtual environment in .venv/ ..."
"$PYTHON_BIN" -m venv .venv
else
echo ".venv/ already exists — reusing it."
fi
# shellcheck disable=SC1091
source .venv/bin/activate
echo "Installing dependencies into .venv/ (this does not touch system Python) ..."
pip install --quiet --upgrade pip
pip install --quiet -r requirements.txt
if [ ! -f ".env" ]; then
cp .env.example .env
echo "Created .env from .env.example — edit it and fill in NIM_API_KEY, NIM_BASE_URL, NIM_MODEL."
else
echo ".env already exists — leaving it alone."
fi
echo
echo "Checking for Gitleaks (required unless you deliberately set ALLOW_MISSING_GITLEAKS=1) ..."
if command -v gitleaks >/dev/null 2>&1; then
echo " Found: $(gitleaks version 2>&1 | head -n1)"
else
echo " NOT found. Install it (one-time, system-level, like installing any CLI tool):"
echo " macOS: brew install gitleaks"
echo " Linux: see https://github.com/gitleaks/gitleaks#installing"
echo " Until it's installed, real runs will refuse to start (fails closed by design)."
fi
echo
echo "Setup complete."
echo "Next: edit .env with your NIM credentials, then run scripts/run_daily.sh"