File size: 1,803 Bytes
2cc5253
eeeaee6
a32e584
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2cc5253
 
 
a32e584
2cc5253
9d508e3
 
 
a32e584
2cc5253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eeeaee6
 
 
 
509d1a8
eeeaee6
509d1a8
eeeaee6
2cc5253
a32e584
 
2cc5253
 
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
.PHONY: lint format test coverage complexity maintainability audit security \
        tune pre-process train app smoke-test guardrails check ci pre-commit all

lint:
	uv run ruff check .

format:
	uv run ruff format .

test:
	uv run pytest

coverage:
	uv run pytest --cov=src --cov-report=term-missing

complexity:
	uv run radon cc . -a -s -nb

maintainability:
	uv run radon mi . -s

audit:
	uv run pip-audit

# --severity-level medium: only MEDIUM/HIGH severity fails the build.
# LOW severity findings (e.g. B403 pickle import) are suppressed
# regardless of their confidence level.
security:
	uv run bandit -r . -x ./.venv,./tests --severity-level medium

tune:
	uv run python -m src.tune

# Requires data/survey_results_public.csv
# Validates columns, filters salaries, reduces cardinality, and writes
# config/valid_categories.yaml and config/currency_rates.yaml
pre-process:
	uv run python -m src.preprocess

# Requires data/survey_results_public.csv (run pre-process first)
train:
	uv run python -m src.train

# Requires a trained model (run `make train` first)
app:
	uv run streamlit run app.py

smoke-test:
	uv run python example_inference.py

# Requires training data and a trained model
guardrails:
	uv run python guardrail_evaluation.py

# Mirrors GitHub Actions CI (.github/workflows/ci.yml): lint + test
ci: lint test

# Runs all pre-commit hooks against every file (.pre-commit-config.yaml)
# Setup: uv tool install prek && prek install
pre-commit:
	prek run --all-files

# CI gate: fast checks that require no model or training data
check: lint test complexity maintainability audit security

# Complete workflow: quality checks → pre-process data → train → evaluate
all: format lint test coverage complexity maintainability audit security pre-process train smoke-test guardrails