-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (53 loc) · 2.52 KB
/
Copy pathMakefile
File metadata and controls
75 lines (53 loc) · 2.52 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
PYTHON ?= python3.11
VENV ?= .venv
UV ?= uv
STACK_NAME ?= draftcode
AWS_REGION ?= us-east-1
DATA_S3_PREFIX ?= processed
DRAFTCODE_DRAWS ?= 1000
DRAFTCODE_SEED ?= 42
S3_BUCKET ?=
.PHONY: venv install install-full install-quality test lint predict simulate ingest answer upload-data validate-sample report dashboard api aws-check sam-validate sam-pull-base sam-build sam-deploy clean
venv:
test -x $(VENV)/bin/python || $(UV) venv --python $(PYTHON) $(VENV)
install: venv
$(UV) pip install -e ".[dev]"
install-full: venv
$(UV) pip install -e ".[dev,app,aws]"
install-quality: venv
$(UV) pip install -e ".[quality]"
test:
$(VENV)/bin/pytest -q
lint:
$(VENV)/bin/ruff check src tests
predict:
$(VENV)/bin/draftcode predict --data-dir data/sample --output outputs/predictions.csv --trace outputs/trace.json
simulate:
$(VENV)/bin/draftcode simulate --data-dir data/sample --output outputs/twin.json --draws 1000 --seed 42
ingest:
$(VENV)/bin/draftcode ingest --source data/raw/official --out data/processed
answer:
$(VENV)/bin/draftcode answer --data-dir data/processed --template data/raw/official/answer_card_template.xlsx --out outputs/answer_card.xlsx --draws 1000 --seed 42 --team-id Team01
upload-data:
test -n "$(S3_BUCKET)" || (echo "S3_BUCKET is required, e.g. make upload-data S3_BUCKET=<bucket> DATA_S3_PREFIX=processed" >&2; exit 1)
$(VENV)/bin/draftcode upload-data --source data/processed --bucket "$(S3_BUCKET)" --prefix "$(DATA_S3_PREFIX)"
validate-sample:
$(VENV)/bin/draftcode validate-output --predictions outputs/predictions.csv --expected-picks 10
report:
$(VENV)/bin/draftcode render-report --predictions outputs/predictions.csv --output outputs/report.html
dashboard:
$(VENV)/bin/streamlit run src/draftcode/dashboard.py -- --predictions outputs/predictions.csv
api:
$(VENV)/bin/uvicorn draftcode.api:app --reload --app-dir src
aws-check:
scripts/check_env.sh
sam-validate:
SAM_CLI_TELEMETRY=0 sam validate --template-file infra/template.yaml --region us-east-1
sam-pull-base:
docker pull public.ecr.aws/lambda/python:3.12
sam-build:
SAM_CLI_TELEMETRY=0 sam build --template-file infra/template.yaml
sam-deploy: sam-build
SAM_CLI_TELEMETRY=0 sam deploy --template-file .aws-sam/build/template.yaml --stack-name "$(STACK_NAME)" --region "$(AWS_REGION)" --capabilities CAPABILITY_IAM --resolve-image-repos --parameter-overrides DraftDataS3Prefix="$(DATA_S3_PREFIX)" DraftCodeDraws="$(DRAFTCODE_DRAWS)" DraftCodeSeed="$(DRAFTCODE_SEED)"
clean:
rm -rf .pytest_cache .ruff_cache .mypy_cache outputs/*.csv outputs/*.json