.PHONY: help lint lint-fix format format-check type-check test test-cov validate clean install-dev sync # Default target help: @echo "๐Ÿš€ FastAPI Backend - Development Commands" @echo "" @echo "Setup:" @echo " make install-dev - Install all dependencies with uv (includes dev)" @echo " make sync - Sync dependencies from uv.lock" @echo "" @echo "Quality Checks:" @echo " make lint - Run Ruff linter (check only)" @echo " make lint-fix - Run Ruff linter with auto-fix" @echo " make format - Format code with Ruff" @echo " make format-check - Check if code is formatted" @echo " make type-check - Run mypy type checking" @echo " make validate - Run all checks (lint + format + types)" @echo "" @echo "Testing:" @echo " make test - Run pytest" @echo " make test-cov - Run pytest with coverage report" @echo "" @echo "Cleanup:" @echo " make clean - Remove cache and build artifacts" # ============================================================================ # Setup & Cleanup # ============================================================================ install-dev: @echo "๐Ÿ“ฆ Installing all dependencies with uv (includes dev)..." @uv sync --extra dev @echo "โœ… Development environment ready!" sync: @echo "๐Ÿ”„ Syncing dependencies from uv.lock..." @uv sync --extra dev @echo "โœ… Dependencies synced!" # ============================================================================ # Code Quality # ============================================================================ lint: @echo "๐Ÿ” Running Ruff linter..." @uv run ruff check app/ tests/ lint-fix: @echo "๐Ÿ”ง Running Ruff linter with auto-fix..." @uv run ruff check --fix app/ tests/ format: @echo "โœจ Formatting code with Ruff..." @uv run ruff format app/ tests/ format-check: @echo "๐Ÿ“‹ Checking code formatting..." @uv run ruff format --check app/ tests/ type-check: @echo "๐Ÿ”Ž Running mypy type checking..." @uv run mypy app/ validate: lint format-check type-check @echo "โœ… All quality checks passed!" # ============================================================================ # Testing # ============================================================================ test: @echo "๐Ÿงช Running tests..." @IS_TEST=True PYTHONPATH=. uv run pytest test-cov: @echo "๐Ÿงช Running tests with coverage..." @IS_TEST=True PYTHONPATH=. uv run pytest --cov=app --cov-report=term-missing --cov-report=html -n 16 @echo "๐Ÿ“Š Coverage report generated in htmlcov/index.html" # ============================================================================ # Cleanup # ============================================================================ clean: @echo "๐Ÿงน Cleaning up..." @find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true @find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true @find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true @find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true @find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true @find . -type d -name "htmlcov" -exec rm -rf {} + 2>/dev/null || true @find . -type d -name "build" -exec rm -rf {} + 2>/dev/null || true @find . -type d -name ".uv_cache" -exec rm -rf {} + 2>/dev/null || true @find . -type f -name ".coverage" -delete 2>/dev/null || true @find . -type f -name "*.pyc" -delete 2>/dev/null || true @echo "โœ… Cleanup complete!"