generated from gecrooks/modern-python-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
96 lines (75 loc) · 2.62 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
# Kudos: Adapted from Auto-documenting default target
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.DEFAULT_GOAL := help
PROJECT = qf_diamond_norm
FILES = $(PROJECT) docs/conf.py setup.py
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
all: about coverage lint typecheck docs build ## Run all tests
test: ## Run unittests
pytest --disable-pytest-warnings
coverage: ## Report test coverage
@echo
pytest --disable-pytest-warnings --cov
@echo
lint: ## Lint check python source
@isort --check -m 3 --tc $(PROJECT) || echo "isort: FAILED!"
@black --check --quiet $(PROJECT) || echo "black: FAILED!"
@flake8 --quiet --quiet --output-file=/dev/null $(FILES) || echo "flake8: FAILED!"
delint: ## Run isort and black to delint project
@echo
isort -m 3 --tc $(PROJECT)
@echo
black $(PROJECT)
@echo
typecheck: ## Static typechecking
mypy $(PROJECT)
docs: ## Build documentation
(cd docs; make html)
docs-open: ## Build documentation and open in webbrowser
(cd docs; make html)
open docs/_build/html/index.html
docs-clean: ## Clean documentation build
(cd docs; make clean)
pragmas: ## Report all pragmas in code
@echo
@echo "** Code that needs something done **"
@grep 'TODO' --color -r -n $(FILES) || echo "No TODO pragmas"
@echo
@echo "** Code that needs fixing **"
@grep 'FIXME' --color -r -n $(FILES) || echo "No FIXME pragmas"
@echo
@echo "** Code that needs documenting **"
@grep 'DOCME' --color -r -n $(FILES) || echo "No DOCME pragmas"
@echo
@echo "** Code that needs more tests **"
@grep 'TESTME' --color -r -n $(FILES) || echo "No TESTME pragmas"
@echo
@echo "** Implementation notes **"
@grep 'NB:' --color -r -n $(FILES) || echo "No NB implementation notes Pragmas"
@echo
@echo "** Acknowledgments **"
@grep 'kudos:' --color -r -n -i $(FILES) || echo "No kudos"
@echo
@echo "** Pragma for test coverage **"
@grep 'pragma: no cover' --color -r -n $(FILES) || echo "No Typecheck Pragmas"
@echo
@echo "** flake8 linting pragmas **"
@echo "(http://flake8.pycqa.org/en/latest/user/error-codes.html)"
@grep '# noqa:' --color -r -n $(FILES) || echo "No flake8 pragmas"
@echo
@echo "** Typecheck pragmas **"
@grep '# type:' --color -r -n $(FILES) || echo "No Typecheck Pragmas"
about: ## Report versions of dependent packages
@python -m $(PROJECT).about
status: ## git status -uno
@echo
@git status -uno
build: ## Setuptools build
./setup.py clean --all
./setup.py sdist bdist_wheel
clean: ## Clean up after setuptools
./setup.py clean --all
.PHONY: help
.PHONY: docs
.PHONY: build