| 1 |
.DEFAULT_GOAL := all |
| 2 |
|
| 3 |
.PHONY: .uv |
| 4 |
.uv: ## Check that uv is installed |
| 5 |
@uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/' |
| 6 |
|
| 7 |
.PHONY: .pre-commit |
| 8 |
.pre-commit: ## Check that pre-commit is installed |
| 9 |
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/' |
| 10 |
|
| 11 |
.PHONY: install |
| 12 |
install: .uv .pre-commit ## Install the package, dependencies, and pre-commit for local development |
| 13 |
uv sync --frozen --all-groups |
| 14 |
pre-commit install --install-hooks |
| 15 |
|
| 16 |
.PHONY: format |
| 17 |
format: ## Format the code |
| 18 |
uv run ruff format |
| 19 |
uv run ruff check --fix --fix-only |
| 20 |
|
| 21 |
.PHONY: lint |
| 22 |
lint: ## Lint the code |
| 23 |
uv run ruff format --check |
| 24 |
uv run ruff check |
| 25 |
|
| 26 |
.PHONY: test |
| 27 |
test: |
| 28 |
TZ=utc uv run coverage run -m pytest |
| 29 |
uv run tests/mypy_checks.py |
| 30 |
|
| 31 |
.PHONY: testcov |
| 32 |
testcov: test |
| 33 |
@uv run coverage report --show-missing |
| 34 |
@uv run coverage html |
| 35 |
|
| 36 |
.PHONY: mypy |
| 37 |
mypy: |
| 38 |
uv run mypy dirty_equals tests/mypy_checks.py |
| 39 |
|
| 40 |
.PHONY: docs |
| 41 |
docs: |
| 42 |
uv run --group docs mkdocs build --strict |
| 43 |
|
| 44 |
.PHONY: all |
| 45 |
all: lint mypy testcov docs |
| 46 |
|
| 47 |
.PHONY: clean |
| 48 |
clean: |
| 49 |
rm -rf `find . -name __pycache__` |
| 50 |
rm -f `find . -type f -name '*.py[co]' ` |
| 51 |
rm -f `find . -type f -name '*~' ` |
| 52 |
rm -f `find . -type f -name '.*~' ` |
| 53 |
rm -rf .cache |
| 54 |
rm -rf .pytest_cache |
| 55 |
rm -rf .mypy_cache |
| 56 |
rm -rf htmlcov |
| 57 |
rm -rf *.egg-info |
| 58 |
rm -f .coverage |
| 59 |
rm -f .coverage.* |
| 60 |
rm -rf build |
| 61 |
|
| 62 |
.PHONY: help |
| 63 |
help: ## Show this help (usage: make help) |
| 64 |
@echo "Usage: make [recipe]" |
| 65 |
@echo "Recipes:" |
| 66 |
@awk '/^[a-zA-Z0-9_-]+:.*?##/ { \ |
| 67 |
helpMessage = match($$0, /## (.*)/); \ |
| 68 |
if (helpMessage) { \ |
| 69 |
recipe = $$1; \ |
| 70 |
sub(/:/, "", recipe); \ |
| 71 |
printf " \033[36m%-20s\033[0m %s\n", recipe, substr($$0, RSTART + 3, RLENGTH); \ |
| 72 |
} \ |
| 73 |
}' $(MAKEFILE_LIST) |