-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (60 loc) · 1.74 KB
/
Copy pathMakefile
File metadata and controls
78 lines (60 loc) · 1.74 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
all: black isort lint mypy
# docker
up:
@echo "bringing up project...."
docker compose up
down:
@echo "bringing down project...."
docker compose down
build:
@echo "building project...."
docker compose up --build
bash:
@echo "connecting to container...."
docker compose exec fastapi-base bash
# alembic
alembic-scaffold:
@echo "scaffolding migrations folder..."
docker compose exec fastapi-base alembic init migrations
alembic-init:
@echo "initializing first migration...."
docker compose exec fastapi-base alembic revision --autogenerate -m "init"
alembic-make-migrations:
@read -p "Enter migration message: " comment; \
echo "Creating migration file: $$comment"; \
docker compose exec fastapi-base alembic revision --autogenerate -m "$$comment"
alembic-migrate:
@echo "applying migration...."
docker compose exec fastapi-base alembic upgrade head
alembic-reset:
@echo "resetting database...."
docker compose exec fastapi-base alembic downgrade base
# lint
test:
@echo "running pytest...."
docker compose exec fastapi-base pytest --cov-report xml --cov=src tests/
lint:
@echo "running ruff...."
docker compose exec fastapi-base ruff check src
black:
@echo "running black...."
docker compose exec fastapi-base black .
isort:
@echo "running isort...."
docker compose exec fastapi-base isort .
mypy:
@echo "running mypy...."
docker compose exec fastapi-base mypy src/
# database
init-db: alembic-init alembic-migrate
@echo "initializing database...."
docker compose exec fastapi-base python3 src/db/init_db.py
# misc
check: BREW-exists
BREW-exists: ; @which brew > /dev/null
hooks: check
@echo "installing pre-commit hooks...."
uvx pre-commit install
precommit-run:
@echo "running pre-commit hooks...."
uvx pre-commit run --all-files