-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
112 lines (77 loc) · 2.7 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
111
112
# ************************************************
# ********** pip-tools **********
# ************************************************
.PHONY: lock # pin prod dependencies
lock:
pip-compile requirements.in -o requirements.txt
.PHONY: lock.dev # pin dev dependencies
lock.dev:
pip-compile requirements.dev.in -o requirements.dev.txt
.PHONY: lock.all # pin all dependencies
lock.all:
pip-compile requirements.in -o requirements.txt
pip-compile requirements.dev.in -o requirements.dev.txt
.PHONY: sync # sync for prod dependencies
sync:
pip-sync requirements.txt
.PHONY: sync.dev # sync for dev dependencies
sync.dev:
pip-sync requirements.dev.txt
.PHONY: update # lock & sync for prod dependencies
update:
pip-compile requirements.in -o requirements.txt
pip-sync requirements.txt
.PHONY: update.dev # lock & sync for prod dependencies
update.dev:
pip-compile requirements.dev.in -o requirements.dev.txt
pip-sync requirements.dev.txt
.PHONY: update.all # lock & sync for all dependencies
update.all:
pip-compile requirements.in -o requirements.txt
pip-compile requirements.dev.in -o requirements.dev.txt
pip-sync requirements.dev.txt
.PHONY: upgrade # upgrade prod dependencies. Generate new .txt file
upgrade:
pip-compile --upgrade requirements.in -o requirements.txt
.PHONY: upgrade.dev # upgrade dev dependencies. Generate new .dev.txt file
upgrade.dev:
pip-compile --upgrade requirements.dev.in -o requirements.dev.txt
.PHONY: upgrade.all # upgrade all dependencies. Generate new .txt files
upgrade.all:
pip-compile --upgrade requirements.in -o requirements.txt
pip-compile --upgrade requirements.dev.in -o requirements.dev.txt
# ************************************************
# ********** application **********
# ************************************************
.PHONY: run # run the application in a prod mode
run:
# NOTE:configurable via environment variables
gunicorn src.main:app --worker-class uvicorn.workers.UvicornWorker
.PHONY: run.dev # run the application in a dev mode
run.dev:
# NOTE:configurable via environment variables
uvicorn src.main
# ************************************************
# ********** code quality **********
# ************************************************
# fix formatting / and order imports
.PHONY: format
format:
python -m black ./
python -m isort ./
# check type annotations
.PHONY: types
types:
python -m mypy --check-untyped-defs ./src
# run tests
.PHONY: tests
tests:
python -m pytest --cov-report=term-missing -vvv -x .
# check everything
.PHONY: check
check:
python -m ruff .
python -m black --check .
python -m isort --check .
python -m mypy --check-untyped-defs .
python -m pytest --cov-report=term-missing --cov --cov-fail-under=90 .