-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (61 loc) · 2.17 KB
/
Makefile
File metadata and controls
79 lines (61 loc) · 2.17 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
77
78
79
PYTHON ?= python
SOURCE_DIRS := moozy
CLEAN_DIRS := .mypy_cache .ruff_cache build dist .eggs
CLEAN_FILES :=
.DEFAULT_GOAL := help
.PHONY: help bootstrap install-dev install-hooks doctor format format-check lint typecheck compile pre-commit check ci fix clean
help:
@printf '%s\n' \
'Available targets:' \
' make bootstrap Install dev dependencies and git hooks' \
' make install-dev Install the package with dev dependencies into the active env' \
' make install-hooks Install pre-commit git hooks' \
' make doctor Show python and tool versions from the active env' \
' make format Auto-format code with Ruff' \
' make format-check Verify formatting without changing files' \
' make lint Run Ruff lint checks' \
' make typecheck Run mypy on configured typed boundaries' \
' make compile Verify project imports compile' \
' make pre-commit Run configured pre-commit hooks on all files' \
' make check Run the full local validation suite' \
' make fix Apply Ruff fixes, then rerun the full check suite' \
' make clean Remove caches and local build artifacts'
bootstrap: install-dev install-hooks
install-dev:
$(PYTHON) -m pip install --upgrade pip
$(PYTHON) -m pip install -e ".[dev]"
install-hooks:
$(PYTHON) -m pre_commit install
doctor:
@printf 'python: '
@$(PYTHON) --version
@printf 'pip: '
@$(PYTHON) -m pip --version
@printf 'ruff: '
@$(PYTHON) -m ruff --version
@printf 'mypy: '
@$(PYTHON) -m mypy --version
@printf 'pre-commit: '
@$(PYTHON) -m pre_commit --version
format:
$(PYTHON) -m ruff format .
format-check:
$(PYTHON) -m ruff format . --check
lint:
$(PYTHON) -m ruff check .
typecheck:
$(PYTHON) -m mypy --config-file pyproject.toml
compile:
$(PYTHON) -m compileall $(SOURCE_DIRS)
pre-commit:
$(PYTHON) -m pre_commit run --all-files
check: format-check lint typecheck compile
ci: check
fix:
$(PYTHON) -m ruff check . --fix
$(PYTHON) -m ruff format .
$(MAKE) check
clean:
find . -type d -name '__pycache__' -prune -exec rm -rf {} +
find . -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete
rm -rf $(CLEAN_DIRS) $(CLEAN_FILES) *.egg-info