-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
88 lines (53 loc) · 1.68 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
.PHONY: clean \
clean-dev update-dev-req install-dev-req install touch-dev \
check format check-format lint check-typing \
clean-doc doc \
clean-build build-release check-release release
VIRTUAL_ENV = .venv
DEV_BUILD_FLAG = $(VIRTUAL_ENV)/DEV_BUILD_FLAG
clean: clean-dev clean-doc clean-build
# init
clean-dev:
rm -rf $(VIRTUAL_ENV)
update-dev-req: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/pip-compile --upgrade dev-requirements.in
install-dev-req:
python3 -m venv $(VIRTUAL_ENV)
$(VIRTUAL_ENV)/bin/python -m pip install --upgrade pip
$(VIRTUAL_ENV)/bin/pip install -r dev-requirements.txt
$(VIRTUAL_ENV)/bin/pre-commit install --hook-type pre-commit --hook-type pre-push
install:
$(VIRTUAL_ENV)/bin/python setup.py install
touch-dev:
touch $(DEV_BUILD_FLAG)
dev: $(DEV_BUILD_FLAG)
$(DEV_BUILD_FLAG):
$(MAKE) -f Makefile install-dev-req
$(MAKE) -f Makefile install
$(MAKE) -f Makefile touch-dev
# ci
check: check-format lint check-typing
format: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/black src setup.py
check-format: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/black --check src setup.py
lint: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/pylint src setup.py
check-typing: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/mypy src setup.py
# doc
clean-doc:
rm -rf docs
doc: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/pdoc --docformat google src/writepypistat -o docs
# release
clean-build:
rm -rf build
rm -rf dist
rm -rf `find . -name '*.egg-info'`
rm -rf `find . -name '__pycache__'`
build-release: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/python -m build
check-release: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/python -m twine check dist/*.tar.gz dist/*.whl
release: clean-build build-release check-release