-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
69 lines (55 loc) · 1.85 KB
/
Makefile
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
help:
@echo "PYTHON=X.Y init setup development environemnt with specific Python version"
@echo "init setup development environment with defualt Python version 3.11"
@echo "update-dev update devepoment dependencies via pdm and via pre-commit"
@echo "update update all dependencies via pdm and via pre-commit"
@echo "pre-commit setup git hooks"
@echo "check-all run code quality checkers"
@echo "test run quick tests"
@echo "vtest run quick tests with verbose"
@echo "PYTHON=X.Y cov run tests with coverage and with specific Python version"
@echo "cov run tests with coverage and with default Python version 3.11"
@echo "serve-docs serve documents with live-reloading"
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
PYTHON = 3.13
EXTRAS = parser
DEV_EXTRAS = test docs
EXTRAS_ARGS = $(if $(EXTRAS),-G,) $(subst $(SPACE),$(SPACE)-G$(SPACE),$(EXTRAS))
DEV_EXTRAS_ARGS = $(if $(DEV_EXTRAS),-G,) $(subst $(SPACE),$(SPACE)-G$(SPACE),$(DEV_EXTRAS))
# Environment setup
init:
@echo ">> installing $(if $(EXTRAS),\"$(EXTRAS)\" ,)dependencies by pdm"
$(if $(PYTHON),pdm use -f $(PYTHON),)
pdm info && pdm info --env
pdm sync --no-editable -v $(EXTRAS_ARGS) $(DEV_EXTRAS_ARGS)
pdm config -l python.use_venv true
pdm config -l strategy.inherit_metadata true
deinit:
rm -rf .nox
rm -rf __pypackages__
rm -rf .mypy_cache
rm -rf htmlcov
rm -rf .pytest_cache
rm -rf *.egg-info
update-dev:
pdm update $(DEV_EXTRAS_ARGS)
pre-commit autoupdate
update:
pdm update
pre-commit autoupdate
# Environment setup end
pre-commit:
pre-commit install --hook-type commit-msg --hook-type pre-commit --overwrite
check-all:
pre-commit run --all-files
test:
pdm run pytest -q -x --ff --nf
vtest:
pdm run pytest -vv -x --ff --nf
cov:
rm -rf .coverage
nox -p $(PYTHON) -s coverage_test coverage_report -- $(TARGET)
# Docs
serve-docs:
pdm run python scripts/watch_build_and_serve_html_docs.py