forked from H-GenIAL/gide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (42 loc) · 1.44 KB
/
Copy pathMakefile
File metadata and controls
54 lines (42 loc) · 1.44 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
# Define variables
PYTHON_PROJECT_DIR = gide_rag
VENV_DIR = venv
PYTHON = $(VENV_DIR)/bin/python
# Default target
.DEFAULT_GOAL := help
# Help message
help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s %s\n", $$1, $$2}'
# Create virtual environment, activate it and install backend dependencies
create-env:
python3 -m venv $(VENV_DIR)
. $(VENV_DIR)/bin/activate && pip install pip-tools && pip-compile requirements.in && pip install -r requirements.txt
# Run backend server
# Run the backend using Uvicorn
run-backend:
$(VENV_DIR)/bin/uvicorn api.main:app --host 0.0.0.0 --port 3001 --reload
# Run Chroma vector db
run-vecdb:
@echo "Running Vector Database server..."
export PYTHONPATH=$(shell pwd) && chroma run --host localhost --port 8030 --path data/vecdb
# Run tests
test: ## Run backend tests with pytest
@echo "Running tests..."
${PYTHON} -m pytest $(TESTS_DIR)
# Clean up
clean: ## Clean up the environment
rm -rf $(VENV_DIR)
find . -type f -name '*.pyc' -delete
find . -type d -name '__pycache__' -delete
# Format backend code
format: ## Format backend code with black
ruff format ${PYTHON_PROJECT_DIR}
lint:
ruff check --fix gide_rag
# Install pre-commit hooks
install-hooks: ## Install pre-commit hooks
pre-commit install
.PHONY: help create-env install test clean format lint install-hooks