Debian Codegraph @

Makefile

raw
1 _GREEN:=\033[0;32m
2 _BLUE:=\033[0;34m
3 _BOLD:=\033[1m
4 _NORM:=\033[0m
5 ENV:=uv run --frozen --
6 PYTEST_OPTIONS=
7
8
9 .PHONY: help
10 help: ## [DEFAULT] Show this help
11 @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##"}; {printf "${_BLUE}${_BOLD}%-10s${_NORM} %s\n", $$1, $$2}'
12
13
14 .PHONY: all
15 all: ## Do everything taggged with [ALL] below
16 @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep "\[ALL\]" | grep -v "^all" | awk 'BEGIN {FS = ":.*?##"}; {printf "%s ", $$1}' | xargs make
17 @echo "\n ${_GREEN}${_BOLD}PASS${_NORM}\n"
18
19
20 .PHONY: pre-commit
21 pre-commit: .venv/.valid .git/hooks/pre-commit ## [ALL] Run 'pre-commit' on all files
22 ${ENV} pre-commit run --all-files
23
24 .git/hooks/pre-commit: .venv/.valid
25 ${ENV} pre-commit install --install-hooks
26
27
28 .PHONY: test
29 test: .venv/.valid ## [ALL] Run Unittests via 'pytest' with {PYTEST_OPTIONS}
30 ${ENV} pytest -vv ${PYTEST_OPTIONS}
31 @echo "See coverage report:\n\n file://${PWD}/htmlcov/index.html\n"
32
33
34 .PHONY: test2refdata
35 test2refdata: .venv/.valid ## Run Unittests via 'pytest' with {PYTEST_OPTIONS} and update tests/refdata
36 rm -rf tests/refdata
37 touch .test2ref
38 ${ENV} pytest -vv ${PYTEST_OPTIONS}
39 @echo "See coverage report:\n\n file://${PWD}/htmlcov/index.html\n"
40 rm .test2ref
41
42
43 .PHONY: checktypes
44 checktypes: .venv/.valid ## [ALL] Run Type-Checking via 'mypy'
45 ${ENV} mypy src
46
47
48 .PHONY: doc
49 doc: .venv/.valid ## [ALL] Build Documentation via 'mkdocs'
50 ${ENV} make html -C docs
51
52
53 .PHONY: code
54 code: ## Start Visual Studio Code
55 code anytree.code-workspace &
56
57
58 .PHONY: clean
59 clean: ## Remove everything mentioned by '.gitignore' file
60 git clean -Xdf
61
62
63 .PHONY: distclean
64 distclean: ## Remove everything mentioned by '.gitignore' file and UNTRACKED files
65 git clean -xdf
66
67
68 .PHONY: shell
69 shell: ## Open a project specific SHELL. For leaving use 'exit'.
70 ${ENV} ${SHELL}
71
72
73 # Helper
74 .venv/.valid: pyproject.toml uv.lock
75 uv sync --frozen
76 @touch $@
77
78 uv.lock:
79 uv lock