-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
119 lines (89 loc) · 2.04 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.PHONY: all develop test lint clean doc format
.PHONY: clean clean-build clean-pyc clean-test coverage dist doc install lint lint/flake8
all: lint
help:
inv help-make
#
# Setup
#
## Install development dependencies and pre-commit hook (env must be already activated)
develop: install-deps activate-pre-commit configure-git
install-deps:
@echo "--> Installing dependencies"
pip install -U pip setuptools wheel
poetry install
activate-pre-commit:
@echo "--> Activating pre-commit hook"
pre-commit install
configure-git:
@echo "--> Configuring git"
git config branch.autosetuprebase always
#
# testing & checking
#
## Run python tests
test:
@echo "--> Running Python tests"
pytest --ff -x -p no:randomly
@echo ""
test-e2e:
@echo "--> Running E2E tests"
cd tests/e2e && make clean && sleep 10 && make test
#
# Linting
#
## Lint / check typing
lint:
# first a quick ruff pass
ruff check nua*/src/ nua*/tests/
# This takes longer
invoke lint
# lint-imports
#
# Formatting
#
## Format code
format:
invoke format
docformatter --black -i -r nua-*/src
black *.py
isort *.py
#
# Doc
#
.PHONY: doc doc-html doc-pdf
## Build documentation
doc: doc-html doc-pdf
doc-html:
cd doc && make build
doc-pdf:
echo TODO
#
# Everything else
#
install:
poetry install
## Clean up cruft
clean:
-invoke clean
find . -name __pycache__ -print0 | xargs -0 rm -rf
find . -type d -empty -delete
rm -rf .mypy_cache .pytest_cache .ruff_cache .import_linter_cache
rm -rf */.mypy_cache */.pytest_cache */.ruff_cache
rm -f .coverage */.coverage
rm -rf dist nua-*/dist
rm -rf apps/*/*/build_dir
cd doc && make clean
# Remove more cruft
rm -rf *.egg-info *.egg .eggs .cache .mypy_cache .pyre \
.pytest_cache .pytest .DS_Store docs/_build docs/cache docs/tmp \
dist build pip-wheel-metadata junit-*.xml htmlcov coverage.xml
## Clean up cruft and tox/nox virtualenvs
tidy: clean
rm -rf .tox .nox */.nox */.tox
cd tests/e2e && vagrant destroy -f
rm -rf tests/e2e/.vagrant
## Update dependencies
update-deps:
pip install -U pip setuptools wheel
poetry update