-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (71 loc) · 2.26 KB
/
Copy pathMakefile
File metadata and controls
89 lines (71 loc) · 2.26 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
82
83
84
85
86
87
88
89
.PHONY: help install test test-unit test-integration test-cov clean lint format migrate
help:
@echo "Available commands:"
@echo " make install - Install dependencies"
@echo " make test - Run all tests"
@echo " make test-unit - Run unit tests only"
@echo " make test-integration - Run integration tests only"
@echo " make test-cov - Run tests with coverage report"
@echo " make lint - Run linters"
@echo " make format - Format code with black and isort"
@echo " make clean - Clean up generated files"
@echo ""
@echo "Database commands:"
@echo " make db-init - Initialize database (development)"
@echo " make db-seed - Seed database with test data"
@echo " make migrate - Run database migrations"
@echo " make migrate-create - Create a new migration (autogenerate)"
@echo " make migrate-history - Show migration history"
@echo " make migrate-current - Show current migration revision"
@echo " make migrate-downgrade - Downgrade one migration"
install:
pip install -r requirements-test.txt
test:
pytest
test-unit:
pytest -m unit
test-integration:
pytest -m integration
test-cov:
pytest --cov=app --cov-report=html --cov-report=term-missing
test-watch:
pytest-watch
lint:
flake8 app tests
black --check app tests
isort --check-only app tests
format:
black app tests
isort app tests
clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.coverage" -delete
rm -rf htmlcov/
rm -rf .pytest_cache/
rm -rf .coverage
rm -rf coverage.xml
rm -rf *.egg-info
rm -rf dist/
rm -rf build/
dev:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
db-init:
@echo "Initializing database schema (development only)..."
python -c "from app.core.database import init_db; init_db()"
db-seed:
@echo "Seeding database with initial data..."
python scripts/seed_database.py
# Alembic migration commands
migrate:
alembic upgrade head
migrate-create:
@read -p "Enter migration message: " msg; \
alembic revision --autogenerate -m "$$msg"
migrate-history:
alembic history --verbose
migrate-current:
alembic current
migrate-downgrade:
alembic downgrade -1