Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (48 loc) · 1.69 KB
/
Copy pathMakefile
File metadata and controls
66 lines (48 loc) · 1.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
.PHONY: setup preprocess sql dbt notebook pipeline dashboard test typecheck verify clean
# ============================================================
# E-commerce User Behavior Analytics — Orchestration
# ============================================================
# Absolute paths for dbt so DuckDB / seed references resolve the same way.
export DBT_DUCKDB_PATH := $(CURDIR)/data/processed/analytics.duckdb
export DBT_DATA_PATH := $(CURDIR)/data/processed/user_behavior_cleaned.csv
setup:
pip install -r requirements.lock
pip install -e ".[dev]"
pre-commit install
preprocess:
python -m shoplytics.preprocess \
--input data/raw/UserBehavior.csv \
--output data/processed/
sql:
python -m shoplytics.run_sql
dbt:
cd dbt && dbt run && dbt test
notebook:
jupyter notebook notebooks/
pipeline:
python -m shoplytics.pipeline
dashboard:
streamlit run dashboard/app.py
test:
pytest tests/ -v --cov=shoplytics --cov-report=term-missing --cov-fail-under=20
typecheck:
mypy src/shoplytics
lint:
ruff check src/ tests/ dashboard/
PYTHONUTF8=1 sqlfluff lint sql/
format:
ruff format src/ tests/ dashboard/
format-check:
ruff format --check src/ tests/ dashboard/
audit:
python -m shoplytics.audit_consistency
verify: lint format-check typecheck test audit
python -m shoplytics.validate_data
# Full workflow (local equivalent of a production DAG)
all: preprocess sql dbt pipeline
clean:
rm -f data/processed/*.duckdb
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true