-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
62 lines (49 loc) · 1.3 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
.PHONY: default clean coverage _docs docs doctest spelling format lint pages pre-commit test typecheck
PYTEST_CMD = pytest delu
VIEW_HTML_CMD = open
DOCS_DIR = docs
default:
echo "Hello, World!"
clean:
find delu -type f -name "*.py[co]" -delete -o -type d -name __pycache__ -delete
rm -f .coverage
rm -rf .ipynb_checkpoints
rm -rf .mypy_cache
rm -rf .pytest_cache
rm -rf .ruff_cache
rm -rf dist
rm -rf $(DOCS_DIR)/api/generated
make -C $(DOCS_DIR) clean
coverage:
coverage run -m $(PYTEST_CMD)
coverage report -m
docs:
make -C $(DOCS_DIR) html
_docs: docs
$(VIEW_HTML_CMD) $(DOCS_DIR)/build/html/index.html
pages:
git checkout main
make clean
make docs
git checkout gh-pages
rm -r dev
mv docs/build/html dev
rm -r docs
git add -A
doctest:
xdoctest delu --global-exec "import torch; import torch.nn as nn; import delu"
spelling:
if [[ $(shell uname -m) != "arm64" ]]; then\
make -C $(DOCS_DIR) docs SPHINXOPTS="-W -b spelling";\
fi
lint:
python -m pre_commit_hooks.debug_statement_hook delu/*.py
python -m pre_commit_hooks.debug_statement_hook delu/**/*.py
ruff format --check
ruff check .
# The order is important: clean must be first, docs must precede doctest.
pre-commit: clean lint test docs doctest spelling typecheck
test:
PYTHONPATH='.' $(PYTEST_CMD) $(ARGV)
typecheck:
mypy delu