-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (63 loc) · 1.96 KB
/
Makefile
File metadata and controls
81 lines (63 loc) · 1.96 KB
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
help:
@echo "Available commands:"
@echo " setup Create venv, install deps, start docker, run migrations"
@echo " install Install dependencies"
@echo " run Run the production server"
@echo " dev Run the development server with reload"
@echo " docker-up Start the docker containers"
@echo " docker-down Stop the docker containers"
@echo " migrate Generate a new migration (usage: make migrate msg=\"message\")"
@echo " up Apply all migrations"
@echo " up-one Apply one migration step"
@echo " down Downgrade to base"
@echo " down-one Downgrade one migration step"
@echo " history Show migration history"
@echo " clean Remove cache files"
@echo " lint Run ruff check and pyrefly check"
@echo " format Run ruff format"
@echo " test Run all Python tests"
VENV := .venv
BIN := $(VENV)/bin
setup:
python3 -m venv $(VENV)
$(BIN)/pip install -r requirements.txt
make docker-up
sleep 3
make up
install:
$(BIN)/pip install -r requirements.txt
run:
$(BIN)/uvicorn app.main:app --host 0.0.0.0 --port 8000
dev:
$(BIN)/uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
docker-up:
docker compose up -d
docker-down:
docker compose down
migrate:
@if [ -z "$(msg)" ]; then echo "Error: Provide a message using msg=\"...\""; exit 1; fi
$(BIN)/alembic revision --autogenerate -m "$(msg)"
up:
$(BIN)/alembic upgrade head
up-one:
$(BIN)/alembic upgrade +1
down:
$(BIN)/alembic downgrade base
down-one:
$(BIN)/alembic downgrade -1
history:
$(BIN)/alembic history
clean:
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name ".coverage.*" -delete
find . -type f -name ".coverage" -delete
find . -type f -name "*.pyc" -delete
rm -rf .ruff_cache
lint:
-$(BIN)/ruff check
-$(BIN)/pyrefly check
format:
-$(BIN)/ruff format .
test:
$(BIN)/python -m pytest