File size: 1,862 Bytes
194469b | 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #!/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"
|