forked from kpn/py-timeexecution
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (59 loc) · 1.39 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
# This Makefile requires the following commands to be available:
# * python3.10
# * docker
SRC:=time_execution tests setup.py
.PHONY: pyclean
pyclean:
-find . -name "*.pyc" -delete
-rm -rf *.egg-info build
-rm -rf coverage*.xml .coverage
.PHONY: clean
clean: pyclean
-rm -rf venv
-rm -rf .tox
venv: PYTHON?=python3.10
venv:
$(PYTHON) -m venv venv
# FIXME: unpin when https://github.com/pypa/pip/issues/9215 is fixed
venv/bin/pip install -U "pip==20.2" -q
venv/bin/pip install -r requirements.txt '.[all]'
## Code style
.PHONY: lint
lint: lint/black lint/flake8 lint/isort lint/mypy
.PHONY: lint/black
lint/black: venv
venv/bin/black --diff --check $(SRC)
.PHONY: lint/flake8
lint/flake8: venv
venv/bin/flake8 $(SRC)
.PHONY: lint/isort
lint/isort: venv
venv/bin/isort --diff --check $(SRC)
.PHONY: lint/mypy
lint/mypy: venv
venv/bin/mypy $(SRC)
.PHONY: format
format: format/isort format/black
.PHONY: format/isort
format/isort: venv
venv/bin/isort $(SRC)
.PHONY: format/black
format/black: venv
venv/bin/black $(SRC)
## Tests
.PHONY: unittests
unittests: TOX_ENV?=ALL
unittests: TOX_EXTRA_PARAMS?=""
unittests: venv
venv/bin/tox -e $(TOX_ENV) $(TOX_EXTRA_PARAMS)
.PHONY: test
test: pyclean unittests
## Distribution
.PHONY: changelog
changelog:
venv/bin/gitchangelog
.PHONY: build
build: venv
-rm -rf dist build
venv/bin/python setup.py sdist bdist_wheel
venv/bin/twine check dist/*