-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
70 lines (45 loc) · 1.56 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
CODE = src
TESTS = tests
ALL = $(CODE) $(TESTS)
VENV ?= venv
venv:
sudo python3.8 -m venv $(VENV)
$(VENV)/bin/python3.8 -m pip install --upgrade pip
$(VENV)/bin/python3.8 -m pip install requirements.txt
# for Windows:
win_venv:
python -m venv $(VENV)
$(VENV)\Scripts\python -m pip install --upgrade pip
$(VENV)\Scripts\python -m pip install poetry
$(VENV)\Scripts\poetry install
setup:
$(VENV)/bin/python setup.py install
test:
$(VENV)/bin/pytest -v $(CODE)/$(TESTS)
win_test:
$(VENV)\Scripts\pytest -v $(CODE)\$(TESTS)
lint:
$(VENV)/bin/flake8 --jobs 4 --statistics --show-source $(ALL)
$(VENV)/bin/pylint --jobs 4 --rcfile=setup.cfg $(CODE)
$(VENV)/bin/black --skip-string-normalization --check $(ALL)
win_lint:
$(VENV)\Scripts\flake8 --jobs 4 --statistics --show-source $(ALL)
$(VENV)\Scripts\pylint --jobs 4 --rcfile=setup.cfg $(CODE)
$(VENV)\Scripts\black --skip-string-normalization --check $(ALL)
format:
$(VENV)/bin/isort --apply --recursive $(ALL)
$(VENV)/bin/black --skip-string-normalization $(ALL)
$(VENV)/bin/autoflake --recursive --in-place --remove-all-unused-imports $(ALL)
$(VENV)/bin/unify --in-place --recursive $(ALL)
win_format:
$(VENV)\Scripts\isort --apply --recursive $(ALL)
$(VENV)\Scripts\black --skip-string-normalization $(ALL)
$(VENV)\Scripts\autoflake --recursive --in-place --remove-all-unused-imports $(ALL)
$(VENV)\Scripts\unify --in-place --recursive $(ALL)
up:
uvicorn $(CODE).main:app --host=0.0.0.0 --reload
ci: lint test
win_ci: win_lint win_test
.PHONY: venv
docker:
docker-compose build && docker-compose up -d