-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
110 lines (83 loc) · 2.85 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
VENV = . ./venv/bin/activate;
PKG_DIR = src
TEST_DIR = tests
PKG_NAME = pydecor
SRC_FILES = *.py $(PKG_DIR) $(TEST_DIR)
TEST = pytest \
--cov-config=setup.cfg \
--cov=$(PKG_NAME) \
--cov-report=term \
--cov-report=xml:coverage.xml \
--doctest-modules \
$(PKG_DIR) \
$(TEST_DIR)
.PHONY: bench build clean distribute fmt lint test
all: fmt lint test
venv: venv/bin/activate
venv/bin/activate: setup.py requirements.txt requirements-dev.txt
python3 -m venv venv
$(VENV) pip install -e .[dev]
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)"
git push --tags
SRC_INPUTS := $(shell find src/pydecor -name \*.py -print)
DOC_INPUTS := $(shell find docs -name \*.rst -print)
docs: venv docs/conf.py docs/Makefile $(DOC_INPUTS) $(SRC_INPUTS)
rm -rf docs/_build
$(VENV) pip install -r docs/requirements.txt
$(VENV) sphinx-apidoc -o docs src/pydecor --separate -f
make text --directory=docs
make html --directory=docs
touch docs/
# DOC_INPUTS := $(shell find src/pydecor -name \*.py -print)
# docs/index.rst: $(DOC_INPUTS) docs/conf.py docs-clean
# rm -rf docs/_build
# $(VENV) pip install -r docs/requirements.txt
# $(VENV) sphinx-apidoc -o docs src/pydecor --separate -f
# make text --directory=docs
# make html --directory=docs
# touch docs/index.rst
fmt: venv
$(VENV) black $(SRC_FILES)
lint: venv
$(VENV) black --check $(SRC_FILES)
$(VENV) flake8 $(SRC_FILES)
$(VENV) mypy $(SRC_FILES)
$(VENV) pylint --errors-only $(SRC_FILES)
# $(VENV) pydocstyle $(SRC_FILES)
setup: venv-clean venv
test: venv
$(VENV) $(TEST)
tox: venv
TOXENV=$(TOXENV) tox
test-docker-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-docker-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-docker-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-docker-pypy:
docker run --rm -it --mount type=bind,source="$(PWD)",target="/src" -w "/src" \
pypy:3 bash -c "make clean && pip install -e .[dev] && $(TEST); make clean"
test-docker: test-docker-3.6 test-docker-3.7 test-docker-3.8 test-docker-pypy3