-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
61 lines (42 loc) · 1.53 KB
/
Copy pathjustfile
File metadata and controls
61 lines (42 loc) · 1.53 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
set windows-shell := ["powershell.exe", "-c"]
set dotenv-filename := ".env"
container-name := "db_postgres"
db-user := "postgres"
db-port := "postgres"
export PYTHONPATH := "src"
run:
uv run python src/main.py
run-docker:
docker-compose up --build
test path="tests":
uv run pytest {{ path }}
coverage:
uv run pytest tests --cov=src --cov-report=term-missing --cov-report=html
pre-commit-all:
pre-commit run --all-files --show-diff-on-failure
alembic-gen:
alembic revision --autogenerate
alembic-upg revision="head":
alembic upgrade {{ revision }}
alembic-drop revision="base":
alembic downgrade {{ revision }}
create-db db-name="some_db":
docker exec -it {{ container-name }} psql -U {{ db-user }} -c "CREATE DATABASE {{ db-name }};"
# Drop database (force disconnect and drop)
delete-db db-name="some_db":
docker exec -it {{ container-name }} psql -U {{ db-user }} -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '{{ db-name }}' AND pid <> pg_backend_pid();"
docker exec -it {{ container-name }} psql -U {{ db-user }} -c "DROP DATABASE IF EXISTS {{ db-name }};"
# Recreate database (drop and create)
recreate-db db-name="some_db":
just delete-db {{ db-name }}
just create-db {{ db-name }}
just alembic-upg
upg:
uv sync --upgrade
ruff-c:
ruff check ./src --fix --config ./pyproject.toml
ruff-f:
ruff format ./src --config ./pyproject.toml
mypy:
mypy ./src --config-file ./pyproject.toml
lint: ruff-c ruff-f mypy