This repository has been archived by the owner on Jan 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
107 lines (76 loc) · 3.32 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
.PHONY: help bootstrap clean clean-build clean-test clean-venv flake8-check pylint-check test test35 test36 test37 test38 test39 docs clean-docs black-check black isort-check isort coverage test-upload upload release dist dist-check
.DEFAULT_GOAL := help
TOXOPTIONS ?=
TOXINI ?= tox.ini
TOX = tox -c $(TOXINI) $(TOXOPTIONS)
# empty TESTS delegates to TOXINI
TESTS ?=
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-z0-9A-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
help: ## show this help
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
bootstrap: ## verify that tox is available and pre-commit hooks are active
python scripts/bootstrap.py
clean: ## remove all build, docs, test, and coverage artifacts, as well as tox environments
python scripts/clean.py all
clean-build: ## remove build artifacts
python scripts/clean.py build
clean-tests: ## remove test and coverage artifacts
python scripts/clean.py tests
clean-venv: ## remove tox virtual environments
python scripts/clean.py venv
clean-docs: ## remove documentation artifacts
python scripts/clean.py docs
flake8-check: bootstrap ## check style with flake8
$(TOX) -e run-flake8
pylint-check: bootstrap ## check style with pylint
$(TOX) -e run-pylint
test: bootstrap ## run tests for all supported Python versions
$(TOX) -e py38-test -- $(TESTS)
test35: bootstrap ## run tests for Python 3.5
$(TOX) -e py35-test -- $(TESTS)
test36: bootstrap ## run tests for Python 3.6
$(TOX) -e py36-test -- $(TESTS)
test37: bootstrap ## run tests for Python 3.7
$(TOX) -e py37-test -- $(TESTS)
test38: bootstrap ## run tests for Python 3.8
$(TOX) -e py38-test -- $(TESTS)
test39: bootstrap ## run tests for Python 3.9
$(TOX) -e py39-test -- $(TESTS)
docs: bootstrap ## generate Sphinx HTML documentation, including API docs
$(TOX) -e docs
@echo "open docs/_build/html/index.html"
black-check: bootstrap ## Check all src and test files for complience to "black" code style
$(TOX) -e run-blackcheck
black: bootstrap ## Apply 'black' code style to all src and test files
$(TOX) -e run-black
isort-check: bootstrap ## Check all src and test files for correctly sorted imports
$(TOX) -e run-isortcheck
isort: bootstrap ## Sort imports in all src and test files
$(TOX) -e run-isort
coverage: test37 ## generate coverage report in ./htmlcov
$(TOX) -e coverage
@echo "open htmlcov/index.html"
test-upload: bootstrap clean-build dist ## package and upload a release to test.pypi.org
$(TOX) -e run-cmd -- twine check dist/*
$(TOX) -e run-cmd -- twine upload --repository-url https://test.pypi.org/legacy/ dist/*
upload: bootstrap clean-build dist ## package and upload a release to pypi.org
$(TOX) -e run-cmd -- twine check dist/*
$(TOX) -e run-cmd -- twine upload dist/*
release: bootstrap ## Create a new version, package and upload it
python3.8 -m venv .venv/release
.venv/release/bin/python -m pip install click gitpython pytest
.venv/release/bin/python ./scripts/release.py
dist: bootstrap ## builds source and wheel package
$(TOX) -e run-cmd -- python setup.py sdist
$(TOX) -e run-cmd -- python setup.py bdist_wheel
ls -l dist
dist-check: bootstrap ## Check all dist files for correctness
$(TOX) -e run-cmd -- twine check dist/*