-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (51 loc) · 1.5 KB
/
Copy pathMakefile
File metadata and controls
63 lines (51 loc) · 1.5 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
# ---------------------------
# Settings
# ---------------------------
# Where you want the venv to live (outside the repo)
VENV := venv
PYTHON := $(VENV)/bin/python3.12
PIP := $(VENV)/bin/pip
UVICORN := $(VENV)/bin/uvicorn
APP := app.main:app
REQUIREMENTS := requirements.txt
# ---------------------------
# PHONY targets
# ---------------------------
.PHONY: venv install run test clean reset
# ---------------------------
# Create venv (in ~/Documents/code)
# ---------------------------
venv:
@echo "🔧 Creating Python 3.12 virtual environment at $(VENV)..."
python3.12 -m venv $(VENV)
@echo "📦 Upgrading pip..."
$(PYTHON) -m pip install --upgrade pip setuptools wheel
# ---------------------------
# Install dependencies
# ---------------------------
install: venv
@echo "📦 Installing dependencies..."
$(PIP) install -r $(REQUIREMENTS)
# ---------------------------
# Run the API
# ---------------------------
run:
@echo "🚀 Starting FastAPI server..."
$(UVICORN) $(APP) --reload --port 8000
# ---------------------------
# Run tests with Python 3.12
# ---------------------------
test:
@echo "🧪 Running tests with Python 3.12..."
$(PYTHON) -m pytest -vv --disable-warnings
# ---------------------------
# Clean venv in ~/Documents/code
# ---------------------------
clean:
@echo "🧹 Removing external venv at $(VENV)..."
rm -rf $(VENV)
# ---------------------------
# Full reset (clean + reinstall)
# ---------------------------
reset: clean install
@echo "✨ Environment reset complete!"