-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (59 loc) · 1.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
PROJECT_NAME:=mono
VIRTUAL_ENV:=venv
# Development
init-venv:
python -m venv $(VIRTUAL_ENV)
install-requirements:
$(VIRTUAL_ENV)/bin/pip install -r requirements.txt
install-requirements-tests:
$(VIRTUAL_ENV)/bin/pip install -r requirements-tests.txt
install-all:
make install-requirements install-requirements-tests
start-infra:
docker-compose up -d
stop-infra:
docker-compose down
dev:
$(VIRTUAL_ENV)/bin/python -m application.driver --host 127.0.0.1 --port 8080 --debug
run:
$(VIRTUAL_ENV)/bin/python -m application.driver --host 0.0.0.0 --port 8080
test:
@$(VIRTUAL_ENV)/bin/pytest -c pytest.ini
report: SHELL:=/bin/bash
report:
$(VIRTUAL_ENV)/bin/codecov
bandit:
$(VIRTUAL_ENV)/bin/bandit -ll -r application tests
pylint:
$(VIRTUAL_ENV)/bin/pylint application tests
flake8:
$(VIRTUAL_ENV)/bin/flake8 application tests
mypy:
$(VIRTUAL_ENV)/bin/mypy
black:
$(VIRTUAL_ENV)/bin/black -S --check application tests
isort:
$(VIRTUAL_ENV)/bin/isort -m 3 -tc -w 88 -c -rc application tests
check:
make bandit pylint flake8 mypy isort black
format:
$(VIRTUAL_ENV)/bin/isort -m 3 -tc -w 88 -rc application tests
$(VIRTUAL_ENV)/bin/black -S application tests
# Database
db-revision:
PYTHONPATH=$(CURDIR) $(VIRTUAL_ENV)/bin/alembic revision --autogenerate --rev-id $(r) -m $(m)
db-upgrade:
PYTHONPATH=$(CURDIR) $(VIRTUAL_ENV)/bin/alembic upgrade head
db-downgrade:
PYTHONPATH=$(CURDIR) $(VIRTUAL_ENV)/bin/alembic downgrade head
# Docker
docker-build:
docker build -t $(PROJECT_NAME):latest .
docker-build-clean:
docker rmi $$(docker images -f "dangling=true" -q)
# Thrift
thrift-py:
@for f in application/thrifts/protocols/*.thrift; do \
echo $${f}; \
thrift -out $(CURDIR) --gen py $${f}; \
done