|
| 1 | +.PHONY: install format lint test clean check-types check-format check-sort-imports sort-imports build help |
| 2 | +.DEFAULT_GOAL := help |
| 3 | + |
| 4 | +# Allow passing arguments to make targets (e.g., make test ARGS="...") |
| 5 | +ARGS ?= |
| 6 | + |
| 7 | +install: ## Install the project and all dependencies |
| 8 | + @echo "🚀 Installing project dependencies with uv" |
| 9 | + uv sync |
| 10 | + |
| 11 | +format: ## Format code with isort and black |
| 12 | + @echo "🎨 Formatting code" |
| 13 | + uv run isort ./sql_redis ./tests/ --profile black |
| 14 | + uv run black ./sql_redis ./tests/ |
| 15 | + |
| 16 | +check-format: ## Check code formatting |
| 17 | + @echo "🔍 Checking code formatting" |
| 18 | + uv run black --check ./sql_redis ./tests/ |
| 19 | + |
| 20 | +sort-imports: ## Sort imports with isort |
| 21 | + @echo "📦 Sorting imports" |
| 22 | + uv run isort ./sql_redis ./tests/ --profile black |
| 23 | + |
| 24 | +check-sort-imports: ## Check import sorting |
| 25 | + @echo "🔍 Checking import sorting" |
| 26 | + uv run isort ./sql_redis ./tests/ --check-only --profile black |
| 27 | + |
| 28 | +check-types: ## Run mypy type checking |
| 29 | + @echo "🔍 Running mypy type checking" |
| 30 | + uv run python -m mypy ./sql_redis |
| 31 | + |
| 32 | +lint: format check-types ## Run all linting (format + type check) |
| 33 | + |
| 34 | +test: ## Run tests (pass extra args with ARGS="...") |
| 35 | + @echo "🧪 Running tests" |
| 36 | + uv run python -m pytest $(ARGS) |
| 37 | + |
| 38 | +test-verbose: ## Run tests with verbose output |
| 39 | + @echo "🧪 Running tests (verbose)" |
| 40 | + uv run python -m pytest -vv -s $(ARGS) |
| 41 | + |
| 42 | +test-cov: ## Run tests with coverage report |
| 43 | + @echo "🧪 Running tests with coverage" |
| 44 | + uv run python -m pytest --cov=sql_redis --cov-report=term-missing --cov-report=html $(ARGS) |
| 45 | + |
| 46 | +check: lint test ## Run all checks (lint + test) |
| 47 | + |
| 48 | +build: ## Build wheel and source distribution |
| 49 | + @echo "🏗️ Building distribution packages" |
| 50 | + uv build |
| 51 | + |
| 52 | +clean: ## Clean up build artifacts and caches |
| 53 | + @echo "🧹 Cleaning up directory" |
| 54 | + find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true |
| 55 | + find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true |
| 56 | + find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true |
| 57 | + find . -type d -name ".coverage" -delete 2>/dev/null || true |
| 58 | + find . -type d -name "htmlcov" -exec rm -rf {} + 2>/dev/null || true |
| 59 | + find . -type d -name "dist" -exec rm -rf {} + 2>/dev/null || true |
| 60 | + find . -type d -name "build" -exec rm -rf {} + 2>/dev/null || true |
| 61 | + find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true |
| 62 | + find . -type f -name "*.log" -exec rm -rf {} + 2>/dev/null || true |
| 63 | + |
| 64 | +help: ## Show this help message |
| 65 | + @echo "Available commands:" |
| 66 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' |
| 67 | + |
0 commit comments