#!/bin/bash # Face Recognition API Setup Script set -e echo "🚀 Setting up Face Recognition API..." # Check if Python 3.11+ is installed python_version=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2) required_version="3.11" if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n1)" != "$required_version" ]; then echo "❌ Python 3.11 or higher is required. Current version: $python_version" exit 1 fi echo "✅ Python version check passed: $python_version" # Create virtual environment if [ ! -d "venv" ]; then echo "📦 Creating virtual environment..." python3 -m venv venv fi # Activate virtual environment echo "🔧 Activating virtual environment..." source venv/bin/activate # Upgrade pip echo "⬆️ Upgrading pip..." pip install --upgrade pip # Install dependencies echo "📚 Installing dependencies..." pip install -e ".[dev,test]" # Copy environment file if [ ! -f ".env" ]; then echo "📝 Creating .env file from template..." cp .env.example .env echo "⚠️ Please edit .env file with your Supabase credentials" else echo "✅ .env file already exists" fi # Create necessary directories echo "📁 Creating directories..." mkdir -p uploads mkdir -p temp mkdir -p logs # Install pre-commit hooks echo "🪝 Installing pre-commit hooks..." pre-commit install # Run initial checks echo "🔍 Running initial code checks..." ruff check . --exclude=venv,build,dist --fix || true ruff format . --exclude=venv,build,dist echo "✅ Setup complete!" echo "" echo "Next steps:" echo "1. Edit .env file with your Supabase credentials" echo "2. Run the SQL files in sql/ directory in your Supabase SQL Editor" echo "3. Activate virtual environment: source venv/bin/activate" echo "4. Start development server: make dev" echo "" echo "For more commands, run: make help"