-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (74 loc) · 3.68 KB
/
Makefile
File metadata and controls
90 lines (74 loc) · 3.68 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
# ─── Paths ────────────────────────────────────────────────────────────────────
PYTHON := .venv/bin/python
UVICORN := .venv/bin/uvicorn
RUFF := .venv/bin/ruff
CZ := .venv/bin/cz
NGROK := ngrok
# ─── Phony targets ────────────────────────────────────────────────────────────
.PHONY: help install install-dev dev tunnel webhook-info lint fix format check commit bump changelog clean
# Default target
help:
@echo ""
@echo " Usage: make <target>"
@echo ""
@echo " Setup"
@echo " install Install production dependencies into .venv"
@echo " install-dev Install dev/tooling dependencies into .venv"
@echo ""
@echo " Development"
@echo " dev Run the FastAPI server locally with hot-reload"
@echo " tunnel Start uvicorn + ngrok and auto-register Telegram webhook"
@echo " webhook-info Show the currently registered Telegram webhook"
@echo ""
@echo " Quality"
@echo " lint Check code with ruff (no changes)"
@echo " fix Auto-fix lint issues with ruff"
@echo " format Format code with ruff formatter"
@echo " check lint + format check (CI-friendly, no changes)"
@echo ""
@echo " Commits & versioning"
@echo " commit Open commitizen interactive commit prompt"
@echo " bump Bump version based on commit history"
@echo " changelog Generate / update CHANGELOG.md"
@echo ""
@echo " Misc"
@echo " clean Remove __pycache__ and .ruff_cache"
@echo ""
# ─── Setup ────────────────────────────────────────────────────────────────────
install:
python3 -m venv .venv
$(PYTHON) -m pip install --upgrade pip
$(PYTHON) -m pip install -r requirements.txt
install-dev: install
$(PYTHON) -m pip install -r requirements-dev.txt
# ─── Development ──────────────────────────────────────────────────────────────
dev:
$(UVICORN) src.main:app --reload --host 0.0.0.0 --port 8000
tunnel:
@chmod +x scripts/tunnel.sh
@bash scripts/tunnel.sh
webhook-info:
@source .env && curl -s "https://api.telegram.org/bot$${TELEGRAM_BOT_TOKEN}/getWebhookInfo" | python3 -m json.tool
# ─── Quality ──────────────────────────────────────────────────────────────────
lint:
$(RUFF) check .
fix:
$(RUFF) check --fix .
format:
$(RUFF) format .
# Runs both lint and format-check without modifying files (safe for CI)
check:
$(RUFF) check .
$(RUFF) format --check .
# ─── Commits & versioning ─────────────────────────────────────────────────────
commit:
$(CZ) commit
bump:
$(CZ) bump --changelog
changelog:
$(CZ) changelog
# ─── Misc ─────────────────────────────────────────────────────────────────────
clean:
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
@echo "Cleaned."