-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (102 loc) · 3.79 KB
/
Makefile
File metadata and controls
126 lines (102 loc) · 3.79 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
.PHONY: help install dev-install lint typecheck test test-unit test-bench \
up down logs topics generate benchmark clean
PYTHON := python3
PIP := pip3
PYTEST := pytest
DOCKER := docker compose
# Default target
help:
@echo "StreamGraph — available targets:"
@echo ""
@echo " Setup"
@echo " install Install production dependencies"
@echo " dev-install Install all dependencies including dev tools"
@echo ""
@echo " Quality"
@echo " lint Run ruff linter"
@echo " typecheck Run mypy type checker"
@echo " test Run all unit tests with coverage"
@echo " test-unit Run unit tests only (fast)"
@echo " test-bench Run pytest benchmarks"
@echo ""
@echo " Local Dev"
@echo " up Start full Docker Compose stack"
@echo " down Stop and remove containers"
@echo " logs Tail logs from all services"
@echo " topics Create Kafka topics"
@echo " generate Run generator (stdout, 30 s preview)"
@echo " benchmark Run standalone Python benchmarks"
@echo ""
@echo " Feast"
@echo " feast-apply Apply feature store definitions"
@echo " feast-materialize Materialize features to Redis"
@echo ""
@echo " Cleanup"
@echo " clean Remove build artefacts and caches"
# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
install:
$(PIP) install -e .
dev-install:
$(PIP) install -e ".[dev]"
pre-commit install
# ---------------------------------------------------------------------------
# Quality gates
# ---------------------------------------------------------------------------
lint:
ruff check src/ generator/ tests/ benchmarks/
typecheck:
mypy src/streamgraph
test:
$(PYTEST) tests/ -v --cov=src/streamgraph --cov-report=term-missing
test-unit:
$(PYTEST) tests/unit/ -v -x
test-bench:
$(PYTEST) benchmarks/ --benchmark-sort=mean -v
# ---------------------------------------------------------------------------
# Docker Compose
# ---------------------------------------------------------------------------
up:
$(DOCKER) up -d --build
@echo ""
@echo "Services started:"
@echo " Kafka UI : http://localhost:8080"
@echo " Flink UI : http://localhost:8081"
@echo " Grafana : http://localhost:3000 (admin / streamgraph)"
@echo " Prometheus : http://localhost:9090"
@echo " Redis : localhost:6379"
down:
$(DOCKER) down -v
logs:
$(DOCKER) logs -f
topics:
bash scripts/setup_kafka_topics.sh
generate:
$(PYTHON) -m generator.fraud_ring_generator \
--stdout \
--events-per-second 50 \
--dry-run
# ---------------------------------------------------------------------------
# Benchmarks
# ---------------------------------------------------------------------------
benchmark:
PYTHONPATH=src:. $(PYTHON) benchmarks/bench_union_find.py
PYTHONPATH=src:. $(PYTHON) benchmarks/bench_pipeline.py
# ---------------------------------------------------------------------------
# Feast
# ---------------------------------------------------------------------------
feast-apply:
cd feast && feast apply
feast-materialize:
cd feast && feast materialize-incremental $$(date -u +%Y-%m-%dT%H:%M:%S)
# ---------------------------------------------------------------------------
# Cleanup
# ---------------------------------------------------------------------------
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name htmlcov -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .mypy_cache -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true
rm -rf .coverage dist build *.egg-info