-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
109 lines (89 loc) · 3.69 KB
/
Makefile
File metadata and controls
109 lines (89 loc) · 3.69 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
.PHONY: help install install-dev test test-cov lint clean run-backend run-worker docker-up docker-down docker-logs docker-rebuild venv migrate-up migrate-down migrate-generate migrate-check migrate-milvus
SHELL := /bin/bash
VENV := .venv
PYTHON := $(VENV)/bin/python
PIP := $(VENV)/bin/uv pip
ACTIVATE := . $(VENV)/bin/activate
help:
@echo "InsightDocs Development Commands"
@echo "================================"
@echo "venv - Create virtual environment"
@echo "install - Install production dependencies"
@echo "install-dev - Install development dependencies"
@echo "test - Run tests"
@echo "test-cov - Run tests with coverage"
@echo "lint - Run code linters"
@echo "clean - Clean up cache and temporary files"
@echo "run-backend - Run the API server"
@echo "run-worker - Run Celery worker"
@echo "migrate-up - Run Alembic migrations up"
@echo "migrate-down - Roll back one Alembic migration"
@echo "migrate-generate - Create a new Alembic migration"
@echo "migrate-check - Show current Alembic revision"
@echo "migrate-milvus - Recreate Milvus collection/schema"
@echo "docker-up - Start all services with Docker Compose"
@echo "docker-down - Stop all services"
@echo "docker-logs - View Docker logs"
@echo "docker-rebuild - Rebuild and restart Docker services"
venv:
@if [ ! -d "$(VENV)" ]; then \
echo "Creating virtual environment..."; \
python3 -m venv $(VENV); \
$(PIP) install --upgrade pip; \
echo "Virtual environment created at $(VENV)"; \
else \
echo "Virtual environment already exists at $(VENV)"; \
fi
install:
@if [ ! -d "$(VENV)" ]; then echo "Error: Virtual environment not found. Run 'make venv' first."; exit 1; fi
$(ACTIVATE) && uv pip install -r requirements.txt
install-dev:
@if [ ! -d "$(VENV)" ]; then echo "Error: Virtual environment not found. Run 'make venv' first."; exit 1; fi
$(ACTIVATE) && uv pip install -r requirements.txt
@if [ -f requirements-dev.txt ]; then \
$(ACTIVATE) && uv pip install -r requirements-dev.txt; \
else \
echo "Note: requirements-dev.txt not found, skipping dev dependencies"; \
fi
test:
@if [ ! -d "$(VENV)" ]; then echo "Error: Virtual environment not found. Run 'make venv' first."; exit 1; fi
$(ACTIVATE) && pytest tests/ -v
test-cov:
@if [ ! -d "$(VENV)" ]; then echo "Error: Virtual environment not found. Run 'make venv' first."; exit 1; fi
$(ACTIVATE) && pytest tests/ --cov=backend --cov-report=html --cov-report=term
lint:
@echo "Linting would go here (flake8, black, mypy, etc.)"
clean:
find . -type d -name "__pycache__" -prune -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
rm -rf .pytest_cache
rm -rf htmlcov
rm -rf .coverage
run-backend:
@if [ ! -d "$(VENV)" ]; then echo "Error: Virtual environment not found. Run 'make venv' first."; exit 1; fi
$(ACTIVATE) && uvicorn backend.api.main:app --reload --host 0.0.0.0 --port 8000
run-worker:
@if [ ! -d "$(VENV)" ]; then echo "Error: Virtual environment not found. Run 'make venv' first."; exit 1; fi
$(ACTIVATE) && celery -A backend.workers.celery_app worker --loglevel=info
docker-up:
docker-compose up -d
docker-down:
docker-compose down
docker-logs:
docker-compose logs -f
docker-rebuild:
docker-compose down
docker-compose build --no-cache
docker-compose up -d
migrate-up:
uv run alembic upgrade head
migrate-down:
uv run alembic downgrade -1
migrate-generate:
@read -p "Enter migration message: " message; \
uv run alembic revision --autogenerate -m "$$message"
migrate-check:
uv run alembic current
migrate-milvus:
uv run python scripts/migrate_milvus_schema.py