-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (60 loc) · 2.99 KB
/
Copy pathMakefile
File metadata and controls
76 lines (60 loc) · 2.99 KB
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
# ---------------------------------------------------------------------------
# Makefile — developer convenience commands
# All commands delegate to uv so you never need to activate .venv manually.
# ---------------------------------------------------------------------------
.DEFAULT_GOAL := help
.PHONY: help install dev test lint format typecheck check docker-build docker-up clean
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
install: ## Sync runtime deps (no dev extras)
uv sync --no-dev
dev: ## Sync all deps including dev extras
uv sync
# ---------------------------------------------------------------------------
# Quality
# ---------------------------------------------------------------------------
lint: ## Run ruff linter
uv run ruff check src tests
format: ## Run ruff formatter (in-place)
uv run ruff format src tests
format-check: ## Verify formatting without writing (for CI)
uv run ruff format --check src tests
typecheck: ## Run mypy type checker
uv run mypy src
# ---------------------------------------------------------------------------
# Tests
# ---------------------------------------------------------------------------
test: ## Run unit tests (excludes integration and e2e markers)
uv run pytest -m "not integration and not e2e"
test-all: ## Run all tests including integration and e2e
uv run pytest
test-cov: ## Run tests with coverage report
uv run pytest --cov=src --cov-report=term-missing -m "not integration and not e2e"
# ---------------------------------------------------------------------------
# Composite
# ---------------------------------------------------------------------------
check: lint format-check typecheck test ## Run all checks (CI equivalent)
# ---------------------------------------------------------------------------
# Docker
# ---------------------------------------------------------------------------
docker-build: ## Build Docker image
docker build -t mypackage:dev .
docker-up: ## Start API service via docker compose
docker compose up api
docker-run: ## Run CLI via docker compose (pass URL= variable)
docker compose run --rm app $(URL)
# ---------------------------------------------------------------------------
# Housekeeping
# ---------------------------------------------------------------------------
clean: ## Remove all caches and build artifacts
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 dist -exec rm -rf {} + 2>/dev/null || true
@echo "Clean."