-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathMakefile
92 lines (79 loc) · 2.24 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
NAME := pytest_localstack
INSTALL_STAMP := .install.stamp
POETRY := $(shell command -v poetry 2> /dev/null)
.DEFAULT_GOAL := help
.PHONY: help
help: ## print this help
@# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: install ## create development virtualenv
install: $(INSTALL_STAMP)
$(INSTALL_STAMP): pyproject.toml poetry.lock
@if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi
$(POETRY) install
@touch $(INSTALL_STAMP)
.PHONY: clean
clean: ## remove all build, test, coverage and Python artifacts
rm -rf \
$(INSTALL_STAMP) \
.coverage \
.mypy_cache \
.venv/ \
build/ \
dist/ \
.eggs/ \
.tox/ \
.coverage \
htmlcov/ \
coverage.xml \
junit.xml \
junit-*.xml
find . \( \
-name "*.egg-info" \
-o -name "*.egg" \
-o -name "*.pyc" \
-o -name "*.pyo" \
-o -name "*~" \
-o -name "__pycache__" \
\) \
-exec rm -fr {} +
.PHONY: lint
lint: $(INSTALL_STAMP) ## check code style
$(POETRY) run isort --check-only ./tests/ $(NAME)
$(POETRY) run black --check ./tests/ $(NAME) --diff
$(POETRY) run pflake8 ./tests/ $(NAME)
$(POETRY) run mypy ./tests/ $(NAME) --ignore-missing-imports
$(POETRY) run bandit -r $(NAME) -s B608
.PHONY: fmt
fmt: $(INSTALL_STAMP) ## apply code style formatting
$(POETRY) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME)
$(POETRY) run black ./tests/ $(NAME)
.PHONY: test
test: $(INSTALL_STAMP) ## run tests
$(POETRY) run pytest
.PHONY: docs
docs: $(INSTALL_STAMP) ## build documentation
$(POETRY) run $(MAKE) -C docs html
.PHONY: docs-live
docs-live: $(INSTALL_STAMP) ## build and view docs in real-time
$(POETRY) run sphinx-autobuild -b html \
-p 0 \
--open-browser \
--watch ./ \
--ignore ".git/*" \
--ignore ".venv/*" \
--ignore "*.swp" \
--ignore "*.pdf" \
--ignore "*.log" \
--ignore "*.out" \
--ignore "*.toc" \
--ignore "*.aux" \
--ignore "*.idx" \
--ignore "*.ind" \
--ignore "*.ilg" \
--ignore "*.tex" \
--ignore "Makefile" \
--ignore "setup.py" \
--ignore "setup.cfg" \
--ignore "Pipfile*" \
docs docs/_build/html