# Makefile for GOXY ML/AI Service .PHONY: help install install-dev setup test lint format clean run docker-build docker-up docker-down migration # Default target help: @echo "GOXY ML/AI Service - Available Commands:" @echo "" @echo " make install - Install production dependencies" @echo " make install-dev - Install development dependencies" @echo " make setup - Complete development setup" @echo " make test - Run tests" @echo " make test-cov - Run tests with coverage" @echo " make lint - Run linters" @echo " make format - Format code with black and ruff" @echo " make clean - Clean generated files" @echo " make run - Run development server" @echo " make docker-build - Build Docker image" @echo " make docker-up - Start Docker containers" @echo " make docker-down - Stop Docker containers" @echo " make migration - Create database migration" @echo " make upgrade - Apply database migrations" @echo "" # Install production dependencies install: pip install --upgrade pip setuptools wheel pip install -r requirements.txt # Install development dependencies install-dev: pip install --upgrade pip setuptools wheel pip install -r requirements-dev.txt pre-commit install # Complete development setup setup: install-dev @echo "Setting up development environment..." mkdir -p logs data/models data/datasets data/cache data/uploads cp -n .env.example .env || true @echo "✓ Development environment ready!" @echo "⚠️ Please edit .env file with your configuration" # Run tests test: pytest -v -m "not slow" # Run tests with coverage test-cov: pytest --cov=app --cov-report=html --cov-report=term-missing # Run all linters lint: @echo "Running linters..." ruff check app/ tests/ mypy app/ black --check app/ tests/ @echo "✓ All linters passed!" # Format code format: @echo "Formatting code..." black app/ tests/ ruff check --fix app/ tests/ @echo "✓ Code formatted!" # Clean generated files clean: @echo "Cleaning generated files..." find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true find . -type f -name "*.pyc" -delete find . -type f -name "*.pyo" -delete find . -type f -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true rm -rf .pytest_cache .coverage htmlcov dist build .ruff_cache .mypy_cache @echo "✓ Cleanup complete!" # Run development server run: uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 --log-level info # Build Docker image docker-build: docker-compose build # Start Docker containers docker-up: docker-compose up -d @echo "✓ Containers started!" @echo " API: http://localhost:8000" @echo " Docs: http://localhost:8000/docs" @echo " Database: localhost:5432" @echo " Redis: localhost:6379" # Stop Docker containers docker-down: docker-compose down # Create database migration migration: @read -p "Enter migration message: " msg; \ alembic revision --autogenerate -m "$$msg" # Apply database migrations upgrade: alembic upgrade head # Downgrade database downgrade: alembic downgrade -1 # Show migration history history: alembic history # Check code security security: bandit -r app/ -c pyproject.toml # Run pre-commit on all files pre-commit: pre-commit run --all-files