-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
75 lines (57 loc) · 1.64 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
VENV = . ./venv/bin/activate;
TEST = pytest --cov-config=setup.cfg --cov=result_types tests
PKG_DIR = falcon_marshmallow
TEST_DIR = tests
LINE_LENGTH = 80
.PHONY: build clean distribute fmt lint setup test
all: fmt lint test
venv: venv/bin/activate
venv/bin/activate: setup.py
python3 -m venv venv
$(VENV) pip install \
black \
flake8 \
mypy \
pylint \
pydocstyle \
pytest \
pytest-runner \
pytest-cov \
tox \
wheel
$(VENV) pip install -e .
touch venv/bin/activate
venv-clean:
rm -rf venv
build: venv build-clean
$(VENV) python setup.py sdist bdist_wheel
# Requires BUILD_TAG to be set on the CLI or in an environment variable,
# e.g. BUILD_TAG=1 make build-dev
build-dev: venv build-clean
$(VENV) python setup.py sdist bdist_wheel
build-clean:
rm -rf build dist
rm -rf *.egg-info
clean:
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
# Requires VERSION to be set on the CLI or in an environment variable,
# e.g. VESRSION=1.0.0 make distribute
distribute: build
git tag -s "v$(VERSION)"
twine upload -s dist/*
git push --tags
fmt: venv
$(VENV) black --line-length $(LINE_LENGTH) *.py $(PKG_DIR) $(TEST_DIR)
lint: venv
$(VENV) pylint --errors-only *.py $(PKG_DIR) $(TEST_DIR)
$(VENV) mypy *.py $(PKG_DIR) $(TEST_DIR)
$(VENV) black --check --line-length $(LINE_LENGTH) *.py $(PKG_DIR) $(TEST_DIR)
setup: venv-clean venv
test: venv
$(VENV) tox
# Requires TESTENV to be set on the CLI or in an environment variable,
# e.g. TESTENV=py37 make test-env to test against python3.7. The specified
# test env must be configured in the tox configuration file.
test-env: venv
$(VENV) tox -e $(TESTENV)