-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
269 lines (241 loc) · 8.52 KB
/
Copy pathTaskfile.yml
File metadata and controls
269 lines (241 loc) · 8.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
version: "3"
tasks:
build:
silent: true
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
sources:
- src/**/*.rs
- build.rs
- Cargo.toml
- Cargo.lock
- pyproject.toml
- resources/**/*
generates:
- .venv/{CACHEDIR.TAG,pyvenv.cfg}
cmds:
- uv sync --all-extras --all-groups --no-group benchmark --dev -C "build-args=--profile {{.PROFILE}}" {{.CLI_ARGS}}
build-local:
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
cmds:
- task: build
vars: { PROFILE: "{{.PROFILE}}", CLI_ARGS: "--locked" }
- pre-commit install
build-ci:
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
cmd:
task: build
vars: { PROFILE: "{{.PROFILE}}", CLI_ARGS: "--locked" }
test-python:
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
deps:
- task: build-ci
vars: { PROFILE: "{{.PROFILE}}" }
sources:
- src/**/*.rs
- build.rs
- Cargo.toml
- Cargo.lock
- pyproject.toml
- resources/**/*
- tests/test_*.py
- docs/**/*.md
cmds:
- uv run --no-sync pytest {README.md,docs,tests/test_*.py,immunum} -n $(( $(nproc) - 2 )) --benchmark-disable {{.CLI_ARGS}}
test-rust:
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
sources:
- src/**/*.rs
- build.rs
- Cargo.toml
- Cargo.lock
- resources/**/*
- tests/cli.rs
cmds:
- cargo test --no-default-features --profile {{.PROFILE}}
- cargo test --test cli --profile {{.PROFILE}}
build-wasm:
sources:
- src/**/*.rs
- build.rs
- Cargo.toml
- Cargo.lock
- resources/**/*
generates:
- pkg/immunum.js
cmds:
- wasm-pack build --target nodejs --features wasm --no-default-features {{.CLI_ARGS}}
build-wasm-web:
sources:
- src/**/*.rs
- build.rs
- Cargo.toml
- Cargo.lock
- resources/**/*
generates:
- docs/assets/wasm/immunum.js
cmds:
- wasm-pack build --target web --out-dir docs/assets/wasm --no-default-features --features wasm {{.CLI_ARGS}}
test-wasm:
deps:
- task: build-wasm
sources:
- src/**/*.rs
- build.rs
- Cargo.toml
- Cargo.lock
- resources/**/*
- tests/test_wasm.mjs
cmds:
- node --test tests/test_wasm.mjs
test:
aliases: [t]
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
cmds:
- task: test-rust
vars: { PROFILE: "{{.PROFILE}}" }
- task: test-python
vars: { PROFILE: "{{.PROFILE}}" }
- task: test-wasm
lint:
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
deps:
- task: build
vars: { PROFILE: "{{.PROFILE}}" }
cmds:
- cargo clippy --all-targets --all-features -- -D warnings
- uv run --no-sync ruff check --config pyproject.toml
- uv run --no-sync ty check --project .
- uv run --no-sync pyrefly check -j 0
- 'git grep "# type: ignore\s*$" src/** && (echo -e "\033[31mBlanket ignores are not allowed\033[0m"; exit 1) || exit 0'
format:
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
deps:
- task: build
vars: { PROFILE: "{{.PROFILE}}" }
cmds:
- cargo fmt --all --check
- uv run --no-sync ruff check --fix --config pyproject.toml
- uv run --no-sync ruff format --config pyproject.toml
coverage:
vars:
PROFILE: '{{.PROFILE | default "dev"}}'
deps:
- task: build
vars: { PROFILE: "{{.PROFILE}}" }
cmds:
- uv run --no-sync coverage run -m pytest {docs,tests/test_*.py} --benchmark-disable {{.CLI_ARGS}}
- uv run --no-sync coverage report -m
pysentry:
cmds:
- uv run --no-sync pysentry-rs .
docs-serve:
deps:
- task: build-wasm-web
cmd: uv run --no-sync --group docs mkdocs serve
docs:
cmd: task docs-serve
docs-build:
deps:
- task: build-wasm-web
cmd: uv run --no-sync --group docs mkdocs build {{.CLI_ARGS}}
benchmark-cli:
desc: "Speed benchmark using Criterion (benches/speed_benchmark.rs)"
cmd: cargo bench --no-default-features {{.CLI_ARGS}}
benchmark-comparison:
desc: "Speed + correctness benchmark: immunum vs antpack vs anarci (1k IGH sequences)"
cmd: uv run --group benchmark pytest benches/bench_comparison.py -v --benchmark-columns=min,mean,stddev --benchmark-group-by=func {{.CLI_ARGS}}
benchmark-speed-polars:
desc: "Speed benchmark for immunum polars across all chain/scheme fixtures"
cmd: uv run pytest benches/bench_polars.py -v --benchmark-columns=min,mean,stddev --benchmark-group-by=func {{.CLI_ARGS}}
bencher-python:
deps:
- task: build-ci
vars: { PROFILE: "{{.PROFILE}}" }
silent: true
desc: "Run Python benchmarks with bencher. Alerts are disabled, used only for tracking performance"
cmd: >-
bencher run
--adapter python_pytest
--token {{.BENCHER_API_TOKEN}}
--file results.json
--threshold-measure latency
--threshold-test t_test
--threshold-max-sample-size 64
--threshold-upper-boundary 0.99
--thresholds-reset
--err
"uv run --no-sync pytest --benchmark-json results.json benches/bench_polars.py"
bencher-rust:
silent: true
desc: "Run Criterion benchmarks with bencher"
cmd: >-
bencher run
--adapter rust_criterion
--token {{.BENCHER_API_TOKEN}}
--threshold-measure latency
--threshold-test t_test
--threshold-max-sample-size 64
--threshold-upper-boundary 0.99
--thresholds-reset
--err
"cargo bench --no-default-features"
bencher:
preconditions:
- sh: '[ -n "{{.BENCHER_API_TOKEN}}" ]'
msg: "BENCHER_API_TOKEN is not set"
cmds:
- task: bencher-rust
- task: bencher-python
benchmark-accuracy:
desc: "Accuracy benchmark across all fixtures (1k sequences, 7 rounds each)"
cmds:
- |
for f in fixtures/validation/*_imgt.csv; do
base=$(basename "$f" .csv)
chain=$(echo "$base" | cut -d_ -f2)
uv run --group benchmark python benches/bench_comparison.py \
--chain "$chain" \
--sizes 1000 --rounds 7 \
--output "./resources/benchmark_results/results_${base}.csv" \
--timeout 1m
done
benchmark-speed:
desc: "Speed benchmark: sizes 100..10M (10x steps), 3 rounds, H/imgt. Pass CLI_ARGS to filter tools, e.g. -- --tools immunum"
cmd: |
uv run --group benchmark python benches/bench_comparison.py \
--sizes 1_000_000 --sizes 500 --sizes 1000 --sizes 5000 --sizes 10_000 --sizes 50_000 --sizes 100_000 --sizes 500_000 --sizes 100 \
--rounds 3 --output ./resources/benchmark_results/results_speed.csv \
--timeout 10m --no-correctness-check {{.CLI_ARGS}}
benchmark:
desc: "Run all benchmarks and produce plots for them"
cmds:
- task: benchmark-accuracy
- task: benchmark-speed
- task: plots
plots:
desc: "Produce plots from benchmark results"
cmd: uv run --script scripts/plots.py
default:
cmds:
- task --list-all
ci:
env:
PROFILE: "dev"
cmds:
- task: lint
- task: pysentry
- task: build-ci
vars: { PROFILE: "{{.PROFILE}}" }
- task: test
vars: { PROFILE: "{{.PROFILE}}" }
- task: coverage
vars: { PROFILE: "{{.PROFILE}}" }
- task: docs-build