-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
124 lines (92 loc) · 2.74 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
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env make
#--- SETUP --------------------------------#
SHELL := /bin/bash
VENV?=.venv
PYTHON=${VENV}/bin/python3
PIP=${VENV}/bin/pip
BUILD_DIR=build
TESTS_DIR=tests
SRC_DIR=src
#--- PYTHON -------------------------------#
$(VENV):
python3 -m venv $(VENV)
${PIP} install -U pip
${PIP} install pip-tools wheel
.PHONY: install
install: $(VENV) requirements.txt
$(VENV)/bin/pip-sync
.PHONY: install-dev
install-dev: $(VENV) requirements-dev.txt
$(VENV)/bin/pip-sync requirements-dev.txt
$(VENV)/bin/pre-commit install
requirements.txt: pyproject.toml
$(VENV)/bin/pip-compile -o requirements.txt pyproject.toml
requirements-dev.txt: pyproject.toml
$(VENV)/bin/pip-compile -o requirements-dev.txt --extra dev pyproject.toml
#--- LINT -------------------------------#
.PHONY: lint
lint:
${VENV}/bin/ruff check --fix --config pyproject.toml ${SRC_DIR} ${TESTS_DIR}
${VENV}/bin/mypy ${SRC_DIR} ${TESTS_DIR}
#--- TEST -------------------------------#
.PHONY: run-debug
run-debug: ${VENV}
PYDEVD_DISABLE_FILE_VALIDATION=1 ${VENV}/bin/watchmedo auto-restart --recursive -p '*.py' \
-- python -m debugpy --listen 0.0.0.0:5678 --wait-for-client \
-m uvicorn --factory vidoso.main:create_app --host 0.0.0.0 --port 8000 --app-dir src/
#--- INFRA -------------------------------#
.PHONY: infra-build
infra-build:
docker compose -f docker/docker-compose.yml build
.PHONY: infra-run
infra-run:
docker compose -f docker/docker-compose.yml up -d
.PHONY: infra-exec-sh
infra-exec-sh:
docker compose -f docker/docker-compose.yml exec localstack /bin/sh
.PHONY: infra-logs
infra-logs:
docker compose -f docker/docker-compose.yml logs -f
.PHONY: infra-stop
infra-stop:
docker compose -f docker/docker-compose.yml down
.PHONY: localstack-status
localstack-status:
localstack status services
.PHONY: db-local-admin-create-tables
db-local-admin-create-tables:
dy admin create table jobs \
--keys job_id,S created_at,N \
--region local --port 4566 \
--table jobs
dy admin create table segments \
--keys transcript_id,S segment_id,N \
--region local --port 4566 \
--table segments
.PHONY: db-local-admin-create-indexes
db-local-admin-create-indexes:
dy admin create index \
--region local --port 4566 \
--table jobs user-index \
--keys user,S created_at,N
dy admin create index \
--region local --port 4566 \
--table segments user-index \
--keys user,S created_at,N
#--- CLEANUP -----------------------------#
.PHONY: clean-build
clean-build:
rm -rf ${BUILD_DIR}
.PHONY: clean-files
clean-files:
find . \( \
-name __pycache__ \
-o -name "*.pyc" \
-o -name .pytest_cache \
-o -name .mypy_cache \
-o -name "*.egg-info" \
-o -name "build" \
-o -name ".ruff_cache" \
\) -exec rm -rf {} +
.PHONY: clean
clean: clean-build clean-files