CoolFace
Apppublic

yashprmr/MeridianFinancial

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
setup.sh77 linesDownload Raw Back to scripts
1#!/usr/bin/env bash2# scripts/setup.sh3# ─────────────────────────────────────────────────────────────────────────────4# Bootstrap script for Linux / macOS developer environments.5#6# Usage:7#   chmod +x scripts/setup.sh8#   ./scripts/setup.sh9# ─────────────────────────────────────────────────────────────────────────────10set -euo pipefail11 12PYTHON_MIN="3.11"13VENV_DIR=".venv"14ENV_FILE=".env"15ENV_EXAMPLE=".env.example"16 17echo "════════════════════════════════════════════════════════════"18echo "  Meridian Financial — Development Environment Setup"19echo "════════════════════════════════════════════════════════════"20 21# ── 1. Check Python version ──────────────────────────────────────────────────22PYTHON_BIN=$(command -v python3.11 2>/dev/null || command -v python3 2>/dev/null || echo "")23if [[ -z "$PYTHON_BIN" ]]; then24    echo "ERROR: Python 3.11+ not found. Install it and retry." >&225    exit 126fi27 28PYTHON_VERSION=$("$PYTHON_BIN" --version 2>&1 | awk '{print $2}')29echo "Python: $PYTHON_VERSION ($PYTHON_BIN)"30 31# ── 2. Create virtual environment ────────────────────────────────────────────32if [[ ! -d "$VENV_DIR" ]]; then33    echo "Creating virtual environment in $VENV_DIR ..."34    "$PYTHON_BIN" -m venv "$VENV_DIR"35else36    echo "Virtual environment already exists at $VENV_DIR"37fi38 39# ── 3. Activate venv ─────────────────────────────────────────────────────────40# shellcheck disable=SC109141source "$VENV_DIR/bin/activate"42echo "Activated: $VIRTUAL_ENV"43 44# ── 4. Upgrade pip ───────────────────────────────────────────────────────────45pip install --quiet --upgrade pip46 47# ── 5. Install dependencies ───────────────────────────────────────────────────48echo "Installing dependencies from requirements.txt ..."49pip install --quiet -r requirements.txt50echo "Dependencies installed."51 52# ── 6. Copy .env.example → .env (if not already present) ────────────────────53if [[ ! -f "$ENV_FILE" ]]; then54    cp "$ENV_EXAMPLE" "$ENV_FILE"55    echo "Created $ENV_FILE from $ENV_EXAMPLE — update it with your real values."56else57    echo "$ENV_FILE already exists — skipping copy."58fi59 60# ── 7. Create required directories ───────────────────────────────────────────61for dir in data/raw data/samples artifacts/features artifacts/models \62            chroma_store mlruns monitoring/reports; do63    mkdir -p "$dir"64done65echo "Directory structure verified."66 67# ── 8. Smoke-test imports ─────────────────────────────────────────────────────68echo "Running smoke tests ..."69python -c "from src.common.config import settings; print('  config OK:', settings)"70python -c "from src.common.logger import get_logger; l=get_logger('setup'); l.info('logger OK')"71echo "Smoke tests passed."72 73echo ""74echo "════════════════════════════════════════════════════════════"75echo "  Setup complete. Activate with: source $VENV_DIR/bin/activate"76echo "════════════════════════════════════════════════════════════"77