forked from ascherj/pathreview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (66 loc) · 2.53 KB
/
Copy pathMakefile
File metadata and controls
93 lines (66 loc) · 2.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
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
.PHONY: setup run test-unit test-integration test-all lint format typecheck check migrate seed reset-db eval clean
SHELL := /bin/bash
# Detect Windows (Git Bash) vs Unix
ifeq ($(OS),Windows_NT)
VENV_BIN := .venv/Scripts
else
VENV_BIN := .venv/bin
endif
PYTHON := $(VENV_BIN)/python
PIP := $(VENV_BIN)/pip
PYTEST := $(VENV_BIN)/pytest
# ---- Setup ----
setup: ## First-time setup: venv, deps, migrations, seed data
python -m venv .venv || python3 -m venv .venv
$(PYTHON) -m pip install --upgrade pip setuptools wheel
$(PIP) install -e ".[dev]"
$(VENV_BIN)/pre-commit install
$(VENV_BIN)/alembic upgrade head
$(PYTHON) scripts/seed_db.py
cd frontend && npm install
@echo ""
@echo "Setup complete. Run 'make run' to start the application."
# ---- Run ----
run: ## Start backend + frontend dev servers
@trap 'kill %1 %2 2>/dev/null' EXIT; \
source $(VENV_BIN)/activate && uvicorn api.main:app --reload --host 0.0.0.0 --port 8000 & \
cd frontend && npm run dev & \
wait
# ---- Tests ----
test-unit: ## Run unit tests only (~30 seconds)
$(PYTEST) tests/unit -v -m unit
test-integration: ## Run integration tests only
$(PYTEST) tests/integration -v -m integration
test-all: ## Run full test suite
$(PYTEST) tests/ -v
# ---- Code Quality ----
lint: ## Run ruff linter
$(VENV_BIN)/ruff check .
format: ## Run black formatter
$(VENV_BIN)/black .
typecheck: ## Run mypy type checker
$(VENV_BIN)/mypy api/ core/ ingestion/ rag/ agent/ safety/
check: lint format typecheck ## Run lint + format + typecheck
# ---- Database ----
migrate: ## Run pending database migrations
$(VENV_BIN)/alembic upgrade head
seed: ## Re-seed the database with sample data
$(PYTHON) scripts/seed_db.py
reset-db: ## Drop and recreate the development database
docker compose exec db psql -U pathreview -d postgres -c "DROP DATABASE IF EXISTS pathreview_dev;"
docker compose exec db psql -U pathreview -d postgres -c "CREATE DATABASE pathreview_dev;"
$(VENV_BIN)/alembic upgrade head
$(PYTHON) scripts/seed_db.py
# ---- Evaluation ----
eval: ## Run the RAG evaluation suite
$(PYTHON) scripts/run_evals.py
# ---- Cleanup ----
clean: ## Remove build artifacts
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
rm -rf .pytest_cache .mypy_cache htmlcov .coverage dist build *.egg-info
# ---- Help ----
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help