-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (44 loc) · 1.7 KB
/
Copy pathMakefile
File metadata and controls
63 lines (44 loc) · 1.7 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
.PHONY: install lock lock-check init-db demo-data lint format format-check type test coverage pip-check bandit security check run-api run-dashboard clean
UV ?= uv
UV_RUN = $(UV) run --locked --extra dev
PYTHON = .venv/bin/python
TRACKED_PYTHON = $(shell git ls-files '*.py')
BANDIT_TARGETS = api config dashboard db features migrations models scrapers scheduler.py backfill.py seed_accuracy.py
install:
$(UV) sync --locked --extra dev
lock:
$(UV) lock
lock-check:
$(UV) lock --check
init-db:
$(UV_RUN) python -m db.migrations
demo-data:
$(UV_RUN) python -m db.demo_data
lint:
$(UV_RUN) ruff check $(TRACKED_PYTHON)
format:
$(UV_RUN) ruff format $(TRACKED_PYTHON)
format-check:
$(UV_RUN) ruff format --check $(TRACKED_PYTHON)
type:
$(UV_RUN) mypy $(TRACKED_PYTHON)
test:
$(UV_RUN) pytest -q
coverage:
$(UV_RUN) pytest --cov=config --cov=db --cov=features --cov=models --cov=scrapers --cov=api --cov=dashboard --cov=scheduler --cov=migrations --cov-report=term-missing --cov-fail-under=69
pip-check:
$(UV) pip check --python $(PYTHON)
bandit:
$(UV_RUN) bandit -c .bandit -r $(BANDIT_TARGETS) -ll
security: pip-check bandit
$(UV_RUN) pip-audit
$(UV_RUN) detect-secrets scan $$(git ls-files -co --exclude-standard) | $(PYTHON) -c 'import json, sys; results = json.load(sys.stdin)["results"]; [print(path) for path in results]; raise SystemExit(bool(results))'
check: lock-check lint format-check type coverage security
run-api:
$(PYTHON) -m uvicorn api.main:app --reload
run-dashboard:
$(PYTHON) -m streamlit run dashboard/app.py --server.address=127.0.0.1
clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
rm -rf .pytest_cache .ruff_cache .mypy_cache htmlcov