-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
94 lines (68 loc) · 2.07 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
VENV = . ./venv/bin/activate;
PKG_DIR = src
TEST_DIR = tests
LINE_LENGTH = 80
SRC_FILES = *.py $(PKG_DIR) $(TEST_DIR)
TEST = pytest \
--cov-config=setup.cfg \
--cov-report=xml:.coverage.xml \
--cov-report=term \
--cov=safetywrap \
--doctest-modules \
--junit-xml=.pytest.xml \
$(PKG_DIR) \
$(TEST_DIR)
.PHONY: bench build clean distribute fmt lint test
all: fmt lint test
# venv: venv/bin/activate
venv: setup.py
python3 -m venv venv
$(VENV) pip install -e .[dev]
touch venv
# touch venv/bin/activate
venv-clean:
rm -rf venv
venv-refresh: venv-clean venv
$(VENV) pip install -e .[dev]
venv-update: venv
$(VENV) pip install -e .[dev]
build: venv build-clean
$(VENV) python setup.py sdist bdist_wheel
build-clean:
rm -rf build dist
rm -rf src/*.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. make VERSION=1.0.0 distribute
distribute: build
$(VENV) scripts/check_ready_to_distribute.py $(VERSION)
git tag -s "v$(VERSION)"
$(VENV) twine upload -s dist/*
git push --tags
fmt: venv
$(VENV) black --line-length $(LINE_LENGTH) $(SRC_FILES)
lint: venv
$(VENV) black --check --line-length $(LINE_LENGTH) $(SRC_FILES)
$(VENV) pydocstyle $(SRC_FILES)
$(VENV) flake8 $(SRC_FILES)
$(VENV) pylint --errors-only $(SRC_FILES)
$(VENV) mypy $(SRC_FILES)
setup: venv-clean venv
test: venv
$(VENV) $(TEST)
tox: venv
TOXENV=$(TOXENV) tox
test-3.6:
docker run --rm -it --mount type=bind,source="$(PWD)",target="/src" -w "/src" \
python:3.6 bash -c "make clean && pip install -e .[dev] && $(TEST); make clean"
test-3.7:
docker run --rm -it --mount type=bind,source="$(PWD)",target="/src" -w "/src" \
python:3.7 bash -c "make clean && pip install -e .[dev] && $(TEST); make clean"
test-3.8:
docker run --rm -it --mount type=bind,source="$(PWD)",target="/src" -w "/src" \
python:3.8 bash -c "make clean && pip install -e .[dev] && $(TEST); make clean"
test-all-versions: test-3.6 test-3.7 test-3.8
bench: venv
source venv/bin/activate; bench/runner.sh