-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
115 lines (92 loc) · 2.59 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.PHONY: all
all: clear-all install-dev test-offline docs built upload coverage-offline
.PHONY: tests
tests: clear-all install-dev
pytest -k '' -q --cache-clear tests/
.PHONY: tests-online
tests-online: clear-all install-dev
pytest -k 'Online' -q --cache-clear tests/
.PHONY: tests-offline
tests-offline: clear-all install-dev
pytest -k 'not Online' -q --cache-clear tests/
.PHONY: lint
lint:
pip install -q -e .[lint_dev] --no-use-pep517
pycodestyle -r --statistics --count --show-source umbr_api/ tests/ examples/ setup.py
pydocstyle -e --count --match='.+\.py' --match-dir='umbr_api|tests|examples'
pep257 -s -e umbr_api/
pep257 -s -e tests/
pep257 -s -e examples/
pep257 -s -e setup.py
pylint --disable=R0401 umbr_api/ tests/* examples/ setup.py
.PHONY: lint_opt
lint_opt:
pip install -q -e .[lint_opt] --no-use-pep517
bandit -r umbr_api/ tests/ examples/ ./setup.py --skip B101
isort --check-only -df -rc -tc umbr_api/ tests/ examples/ setup.py
safety check
pyroma -a ./
check-manifest -v
.PHONY: install-dev
install-dev:
pip install -q -e .[dev] --no-use-pep517
pip install -q -e .[doc] --no-use-pep517
.PHONY: install-doc
install-doc:
pip install -q -e .[doc] --no-use-pep517
.PHONY: coverage-offline
coverage-offline: clear-pyc clear-cov
coverage run -m pytest -k 'not Online' -q --cache-clear tests/
coverage report
coverage annotate
.PHONY: coverage
coverage: clear-pyc clear-cov
coverage run -m pytest
coverage report
coverage annotate
.PHONY: cov
cov: coverage
.PHONY: upload
upload: clear-all built
twine upload dist/*
.PHONY: docs
docs: clear-doc install-dev install-doc
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html
.PHONY: built
built:
python3 setup.py sdist
.PHONY: clear-all
clear-all: clear-pyc clear-cov clear-build clear-doc
.PHONY: clear-venv
clear-venv:
rm -fr ./.venv/
virtualenv .venv
.PHONY: clear-doc
clear-doc:
$(MAKE) -C docs clean
.PHONY: clear-pyc
clear-pyc:
find . -type d -name '__pycache__' -not -path './venv/*' -exec rm -rf {} +
find . -type f -name '*.py[co]' -not -path './venv/*' -exec rm -f {} +
find . -type f -name '*~' -not -path './venv/*' -exec rm -f {} +
.PHONY: clear-cov
clear-cov:
find . -type f -name '*.py,cover' -exec rm -f {} +
rm -fr .pytest_cache
coverage erase
.PHONY: clear-build
clear-build:
rm -fr dist/
rm -fr .eggs/
rm -fr *.egg-info/
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
BROWSER := python3 -c "$$BROWSER_PYSCRIPT"