2api / setup-dev.sh
lin7zhi's picture
Upload folder using huggingface_hub
69fec20 verified
#!/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