-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (47 loc) · 1.75 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
.PHONY: install-dev
install-dev: ## install project including all development dependencies
pip install -e .[test,dev,docs]
.PHONY: maintainability
maintainability: ## run maintainability checks
@radon cc --total-average -nB -s src
.PHONY: vulnerabilities audit
vulnerabilities: ## run vulnerability checks
audit:
@pip-audit
.PHONY: test coverage coverage-ci
test: ## run unit tests
@pytest
coverage: ## collect coverage data and open report in browser
@pytest --doctest-modules --cov --cov-config=pyproject.toml --cov-branch --cov-report term-missing --cov-report html:build/coverage
@test -z "$(CI)" \
&& ( echo "Opening 'build/coverage/index.html'..."; open build/coverage/index.html || start build/coverage/index.html )\
|| echo ""
coverage-ci:
@CI=true "$(MAKE)" coverage
.PHONY: compatibility tox
compatibility: ## run a Python version compatibility test
tox:
@tox
.PHONY: lint
lint: ## run static code checks
@ruff check src tests
.PHONY: format format-ci
format: ## run static code formatting
@ruff format src tests
format-ci:
@ruff format --check --diff src tests
.PHONY: docs docs-clean docs-live docs-open
DOCS_TARGET?=build/docs
docs: ## build documentation
cd docs && BUILDDIR=../${DOCS_TARGET} "$(MAKE)" -b html
docs-clean: ## clears the docs directory and rebuilds
rm -rf ${DOCS_TARGET}
"$(MAKE)" docs
docs-live: ## serve documentation
cd docs && "$(MAKE)" serve
docs-open: ## open documentation
(open build/docs/html/index.html || start build/docs/html/index.html) || echo ""
.PHONY: help
# a nice way to document Makefiles, found here: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'