-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (68 loc) · 2.25 KB
/
Makefile
File metadata and controls
86 lines (68 loc) · 2.25 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
80
81
82
83
84
85
86
.PHONY: clean clean-env check quality style tag-version test env upload upload-test
PROJECT=project
QUALITY_DIRS=$(PROJECT) tests
CLEAN_DIRS=$(PROJECT) tests
PYTHON=uv run python
check: ## run quality checks and unit tests
$(MAKE) style
$(MAKE) quality
$(MAKE) types
$(MAKE) test
clean: ## remove cache files
find $(CLEAN_DIRS) -path '*/__pycache__/*' -delete
find $(CLEAN_DIRS) -type d -name '__pycache__' -empty -delete
find $(CLEAN_DIRS) -name '*@neomake*' -type f -delete
find $(CLEAN_DIRS) -name '*.pyc' -type f -delete
find $(CLEAN_DIRS) -name '*,cover' -type f -delete
find $(CLEAN_DIRS) -name '*.orig' -type f -delete
clean-env: ## remove the virtual environment directory
rm -rf .venv
deploy: ## installs from lockfile
git submodule update --init --recursive
which uv || pip install --user uv
uv sync --frozen --no-dev
init: ## pulls submodules and initializes virtual environment
git submodule update --init --recursive
which uv || pip install --user uv
uv sync --all-groups --all-extras
node_modules:
ifeq (, $(shell which npm))
$(error "No npm in $(PATH), please install it to run pyright type checking")
else
npm install
endif
quality:
$(MAKE) clean
$(PYTHON) -m black --check $(QUALITY_DIRS)
$(PYTHON) -m autopep8 -a $(QUALITY_DIRS)
style:
$(PYTHON) -m autoflake -r -i $(QUALITY_DIRS)
$(PYTHON) -m isort $(QUALITY_DIRS)
$(PYTHON) -m autopep8 -a $(QUALITY_DIRS)
$(PYTHON) -m black $(QUALITY_DIRS)
test: ## run unit tests
$(PYTHON) -m pytest \
-rs \
--cov=./$(PROJECT) \
--cov-report=term \
./tests/
test-%: ## run unit tests matching a pattern
$(PYTHON) -m pytest -s -r fE -k $* ./tests/ --tb=no
test-pdb-%: ## run unit tests matching a pattern with PDB fallback
$(PYTHON) -m pytest -rs --pdb -k $* -v ./tests/
test-ci: ## runs CI-only tests
export "CUDA_VISIBLE_DEVICES=''" && \
$(PYTHON) -m pytest \
-rs \
-m "not ci_skip" \
--cov=./$(PROJECT) \
--cov-report=xml \
--cov-report=term \
./tests/
types:
uv run pyright
update:
uv sync --all-groups --all-extras
help: ## display this help message
@echo "Please use \`make <target>' where <target> is one of"
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'