| 1 |
.PHONY: help build pytest test test-all clean install dev-install lint format docs docs-serve check |
| 2 |
|
| 3 |
help: |
| 4 |
@echo "Available commands:" |
| 5 |
@echo " build - Build the package" |
| 6 |
@echo " pytest - Run tests with pytest" |
| 7 |
@echo " test - Alias for pytest" |
| 8 |
@echo " test-all - Run the full tox matrix" |
| 9 |
@echo " clean - Clean build artifacts" |
| 10 |
@echo " install - Sync project dependencies" |
| 11 |
@echo " dev-install - Sync project with development dependencies" |
| 12 |
@echo " lint - Run linting checks" |
| 13 |
@echo " format - Apply Ruff fixes and format code" |
| 14 |
@echo " docs - Build documentation" |
| 15 |
@echo " docs-serve - Serve documentation locally" |
| 16 |
@echo " check - Run lint, tests, and docs build" |
| 17 |
|
| 18 |
# Build the package |
| 19 |
build: |
| 20 |
uv build |
| 21 |
|
| 22 |
# Run tests with pytest |
| 23 |
pytest: |
| 24 |
uv run pytest --cov=guardian --cov-report=xml --cov-report=term |
| 25 |
|
| 26 |
# Alias for pytest |
| 27 |
test: pytest |
| 28 |
|
| 29 |
# Run the full tox matrix |
| 30 |
test-all: |
| 31 |
uv run tox run |
| 32 |
|
| 33 |
# Clean build artifacts |
| 34 |
clean: |
| 35 |
rm -rf build/ |
| 36 |
rm -rf dist/ |
| 37 |
rm -rf *.egg-info/ |
| 38 |
rm -rf .coverage |
| 39 |
rm -rf .mypy_cache/ |
| 40 |
rm -rf .pytest_cache/ |
| 41 |
rm -rf .ruff_cache/ |
| 42 |
rm -rf .tox/ |
| 43 |
rm -rf htmlcov/ |
| 44 |
find . -type d -name __pycache__ -exec rm -rf {} + |
| 45 |
find . -type f -name "*.pyc" -delete |
| 46 |
|
| 47 |
# Sync the default project environment |
| 48 |
install: |
| 49 |
uv sync |
| 50 |
|
| 51 |
# Sync the development environment |
| 52 |
dev-install: |
| 53 |
uv sync --group dev |
| 54 |
|
| 55 |
# Run linting checks |
| 56 |
lint: |
| 57 |
uv run ruff check . |
| 58 |
uv run mypy ./guardian |
| 59 |
|
| 60 |
# Apply auto-fixes and format code |
| 61 |
format: |
| 62 |
uv run ruff check --fix . |
| 63 |
uv run ruff format . |
| 64 |
|
| 65 |
# Build documentation |
| 66 |
docs: |
| 67 |
uv run mkdocs build |
| 68 |
|
| 69 |
# Serve documentation locally |
| 70 |
docs-serve: |
| 71 |
uv run mkdocs serve |
| 72 |
|
| 73 |
# Run the most common local checks |
| 74 |
check: |
| 75 |
$(MAKE) lint |
| 76 |
$(MAKE) test |
| 77 |
$(MAKE) docs |