File size: 2,513 Bytes
69fec20 |
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
#!/bin/bash
# Development setup script for gcli2api
# This script sets up the development environment
set -e
echo "=========================================="
echo "gcli2api Development Setup"
echo "=========================================="
echo
# Check Python version
echo "Checking Python version..."
python_version=$(python --version 2>&1 | awk '{print $2}')
required_version="3.12"
if ! python -c "import sys; exit(0 if sys.version_info >= (3, 12) else 1)"; then
echo "β Error: Python 3.12 or higher is required. Found: $python_version"
exit 1
fi
echo "β
Python $python_version"
echo
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python -m venv venv
echo "β
Virtual environment created"
else
echo "β
Virtual environment already exists"
fi
echo
# Activate virtual environment
echo "Activating virtual environment..."
source venv/bin/activate
echo "β
Virtual environment activated"
echo
# Upgrade pip
echo "Upgrading pip..."
pip install --upgrade pip -q
echo "β
pip upgraded"
echo
# Install production dependencies
echo "Installing production dependencies..."
pip install -r requirements.txt -q
echo "β
Production dependencies installed"
echo
# Install development dependencies
echo "Installing development dependencies..."
pip install -r requirements-dev.txt -q
echo "β
Development dependencies installed"
echo
# Copy .env.example to .env if it doesn't exist
if [ ! -f ".env" ]; then
echo "Creating .env file from .env.example..."
cp .env.example .env
echo "β
.env file created"
echo "β οΈ Please edit .env file with your configuration"
else
echo "β
.env file already exists"
fi
echo
# Install pre-commit hooks
echo "Installing pre-commit hooks..."
pre-commit install
echo "β
Pre-commit hooks installed"
echo
echo "=========================================="
echo "β
Development setup complete!"
echo "=========================================="
echo
echo "Next steps:"
echo " 1. Edit .env with your configuration"
echo " 2. Run 'make test' to verify setup"
echo " 3. Run 'make run' to start the application"
echo
echo "Available commands:"
echo " make help - Show all available commands"
echo " make test - Run tests"
echo " make lint - Run linters"
echo " make format - Format code"
echo " make run - Run the application"
echo
echo "To activate the virtual environment in the future:"
echo " source venv/bin/activate"
echo
|