aprender 0.30.0

Next-generation ML framework in pure Rust — `cargo install aprender` for the `apr` CLI
Documentation
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
[workspace]
members = [
    ".",
    "crates/aprender-core",
    # --- Pre-existing aprender crates ---
    "crates/aprender-shell",
    "crates/aprender-tsp",
    "crates/aprender-monte-carlo",
    "crates/apr-cli",
    "crates/aprender-bench-tokenizer",
    "crates/aprender-bench-compute",
    # --- APR-MONO Phase 2a: was trueno (compute primitives) ---
    "crates/aprender-compute",
    "crates/aprender-gpu",
    "crates/aprender-explain",
    "crates/aprender-cuda-edge",
    "crates/aprender-ptx-debug",
    "crates/aprender-cupti",
    "crates/aprender-cbtop",
    "crates/aprender-cgp",
    "crates/aprender-quant",
    "crates/aprender-sparse",
    "crates/aprender-fft",
    "crates/aprender-solve",
    "crates/aprender-rand",
    "crates/aprender-image",
    "crates/aprender-tensor",
    "crates/aprender-gemm-codegen",
    "crates/aprender-compute-xtask",
    # --- APR-MONO Phase 2b: was provable-contracts ---
    "crates/aprender-contracts",
    "crates/aprender-contracts-macros",
    "crates/aprender-contracts-cli",
    # --- APR-MONO Phase 2c: was realizar (inference server) ---
    "crates/aprender-serve",
    # --- APR-MONO Phase 2d: was entrenar (training) ---
    "crates/aprender-train",
    "crates/aprender-train-common",
    "crates/aprender-train-lora",
    "crates/aprender-train-distill",
    "crates/aprender-train-inspect",
    "crates/aprender-train-shell",
    "crates/aprender-train-bench",
    "crates/aprender-train-wasm",
    # "crates/aprender-train-canary",  # Excluded: sqlite3 link conflict with burn dep
    # --- APR-MONO Phase 2e: was batuta (orchestration) ---
    "crates/aprender-orchestrate",
    # --- APR-MONO Phase 2f: satellite repos (main crates) ---
    "crates/aprender-profile",
    "crates/aprender-profile-core",
    "crates/aprender-verify",
    "crates/aprender-verify-ml",
    "crates/aprender-data",
    "crates/aprender-simulate",
    "crates/aprender-distribute",
    "crates/aprender-registry",
    "crates/aprender-db",
    "crates/aprender-graph",
    "crates/aprender-rag",
    "crates/aprender-viz",
    # --- APR-MONO Phase 3a: zram sub-crates (enabled) ---
    "crates/aprender-zram",
    "crates/aprender-zram-core",
    "crates/aprender-zram-adaptive",
    "crates/aprender-zram-cli",
    "crates/aprender-zram-generator",
    # --- APR-MONO Phase 3b: presentar sub-crates (enabled) ---
    "crates/aprender-present-core",
    "crates/aprender-present-terminal",
    "crates/aprender-present-widgets",
    "crates/aprender-present-layout",
    "crates/aprender-present-yaml",
    "crates/aprender-present-cli",
    "crates/aprender-present-lib",
    "crates/aprender-present-test",
    "crates/aprender-present-test-macros",
    "crates/aprender-common",
    # --- APR-MONO Phase 3c: test/probar sub-crates (enabled) ---
    "crates/aprender-test-lib",
    "crates/aprender-test-cli",
    "crates/aprender-test-derive",
    "crates/aprender-test-js-gen",
    "crates/aprender-test-showcase",
    # --- APR-MONO Phase 2g: QA playbook crates ---
    "crates/aprender-qa-gen",
    "crates/aprender-qa-runner",
    "crates/aprender-qa-report",
    "crates/aprender-qa-certify",
    "crates/aprender-qa-cli",
    # Remaining excluded (workspace root shells with no src):
    # "crates/aprender-viz-ttop",
    # "crates/aprender-present",
    # "crates/aprender-test",
]
exclude = [
    "fuzz",
    # Old workspace root shells (no package, just held sub-crates):
    "crates/aprender-viz-ttop",
    "crates/aprender-present",
    "crates/aprender-test",
    "crates/aprender-train-canary",
]
resolver = "2"

[workspace.package]
version = "0.30.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/paiml/aprender"
authors = ["Noah Gift <noah@paiml.com>"]
rust-version = "1.89"
keywords = ["machine-learning", "inference", "training", "gpu", "simd"]
categories = ["science", "algorithms"]
homepage = "https://github.com/paiml/aprender"

[workspace.dependencies]
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bincode = "1.3"
rmp-serde = "1.3"
toml = "0.8"

# Error handling
thiserror = "2.0"
anyhow = "1.0"

# Async runtime
tokio = { version = "1", features = ["full"] }
axum = { version = "0.8", features = ["ws"] }
tower = "0.5"

# HTTP
reqwest = { version = "0.12", default-features = false }
ureq = { version = "2.12", features = ["json"] }

# Random / testing
rand = { version = "0.9", features = ["small_rng"] }
rand_chacha = "0.9"
proptest = "1.6"
criterion = { version = "0.7", features = ["html_reports"] }
tempfile = "3.14"

# Data formats
half = { version = "2.4", default-features = false, features = ["std"] }
bytemuck = { version = "1.24", features = ["derive"] }
safetensors = "0.4"

# Parallelism
rayon = "1.10"

# System
chrono = "0.4"
dirs = "6.0"
uuid = { version = "1", features = ["v4"] }
regex = "1.11"
clap = { version = "4.5", features = ["derive"] }

# Compression
lz4_flex = "0.11"
zstd = "0.13"

# Crypto
sha2 = "0.10"

# Chat templates
minijinja = { version = "2.14", features = ["loader", "serde"] }

# Contracts
provable-contracts = "0.3"
provable-contracts-macros = "0.3"
aprender-contracts-macros = { path = "crates/aprender-contracts-macros", version = "0.30.0" }

# YAML
serde_yaml = "0.9"

# HF Hub
hf-hub = { version = "0.4", default-features = false, features = ["ureq"] }

# Workspace-internal crates (paths within the monorepo)
aprender-compute = { path = "crates/aprender-compute", version = "0.30.0" }
aprender-gpu = { path = "crates/aprender-gpu", version = "0.30.0" }
aprender-quant = { path = "crates/aprender-quant", version = "0.30.0" }
aprender-serve = { path = "crates/aprender-serve", version = "0.30.0" }
realizar = { path = "crates/aprender-serve", version = "0.30.0", package = "aprender-serve" }
aprender-train = { path = "crates/aprender-train", version = "0.30.0" }
entrenar = { path = "crates/aprender-train", version = "0.30.0", package = "aprender-train" }
aprender-train-common = { path = "crates/aprender-train-common", version = "0.30.0" }
aprender-orchestrate = { path = "crates/aprender-orchestrate", version = "0.30.0" }
aprender-contracts = { path = "crates/aprender-contracts", version = "0.30.0" }
aprender-profile = { path = "crates/aprender-profile", version = "0.30.0" }
aprender-profile-core = { path = "crates/aprender-profile-core", version = "0.30.0" }
aprender-zram-core = { path = "crates/aprender-zram-core", version = "0.30.0" }
aprender-zram-adaptive = { path = "crates/aprender-zram-adaptive", version = "0.30.0" }
aprender-present-core = { path = "crates/aprender-present-core", version = "0.30.0" }
aprender-present-terminal = { path = "crates/aprender-present-terminal", version = "0.30.0" }
aprender-present-widgets = { path = "crates/aprender-present-widgets", version = "0.30.0" }
aprender-present-layout = { path = "crates/aprender-present-layout", version = "0.30.0" }
aprender-present-yaml = { path = "crates/aprender-present-yaml", version = "0.30.0" }
aprender-present-test = { path = "crates/aprender-present-test", version = "0.30.0" }
aprender-db = { path = "crates/aprender-db", version = "0.30.0" }
aprender-graph = { path = "crates/aprender-graph", version = "0.30.0" }
aprender-rag = { path = "crates/aprender-rag", version = "0.30.0" }
aprender-data = { path = "crates/aprender-data", version = "0.30.0" }

# Additional external deps needed by sub-crates
serde_yaml_ng = "0.10"
crossterm = "0.28"
sysinfo = "0.32"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
image = "0.25"
base64 = "0.22"
syn = { version = "2", features = ["full", "visit"] }
quote = "1"
proc-macro2 = "1"
async-trait = "0.1"
notify = "7"
futures = "0.3"
tokio-tungstenite = "0.24"
indicatif = "0.17"
console = "0.15"

# GPU / WASM
wgpu = "27.0"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = "0.3"
console_error_panic_hook = "0.1"
getrandom = "0.2"
wasm-bindgen-test = "0.3"

# Media / image
gif = "0.13"
png = "0.17"
mp4 = "0.14"

# HTTP middleware
tower-http = { version = "0.6", features = ["fs", "cors", "compression-gzip", "set-header"] }
mime_guess = "2"

# Browser / WASM runtime (heavy optional deps for test framework)
chromiumoxide = { version = "0.8", default-features = false, features = ["tokio-runtime"] }
wasmtime = "43"
bollard = "0.17"

# Old crate name aliases (workspace = true refs in migrated sub-crates)
trueno-zram-core = { path = "crates/aprender-zram-core", version = "0.30.0", package = "aprender-zram-core" }
trueno-zram-adaptive = { path = "crates/aprender-zram-adaptive", version = "0.30.0", package = "aprender-zram-adaptive" }
trueno = { path = "crates/aprender-compute", version = "0.30.0", package = "aprender-compute" }
presentar-core = { path = "crates/aprender-present-core", version = "0.30.0", package = "aprender-present-core" }
presentar-terminal = { path = "crates/aprender-present-terminal", version = "0.30.0", package = "aprender-present-terminal" }
presentar-widgets = { path = "crates/aprender-present-widgets", version = "0.30.0", package = "aprender-present-widgets" }
presentar-layout = { path = "crates/aprender-present-layout", version = "0.30.0", package = "aprender-present-layout" }
presentar-yaml = { path = "crates/aprender-present-yaml", version = "0.30.0", package = "aprender-present-yaml" }
presentar-test = { path = "crates/aprender-present-test", version = "0.30.0", package = "aprender-present-test" }
presentar-test-macros = { path = "crates/aprender-present-test-macros", version = "0.30.0", package = "aprender-present-test-macros" }
jugar-probar-derive = { path = "crates/aprender-test-derive", version = "0.30.0", package = "aprender-test-derive" }
batuta-common = { path = "crates/aprender-common", version = "0.30.0", package = "aprender-common" }

[workspace.lints.rust]
# Safety
# Note: Using "deny" (not "forbid") to allow documented unsafe in mmap module.
# See bundle-mmap-spec.md Section 4 for safety justification.
unsafe_code = "deny"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)', 'cfg(coverage_nightly)', 'cfg(feature, values("explainable-monitor-integration"))'] }
unsafe_op_in_unsafe_fn = "warn"

# Code Quality
unreachable_pub = "allow"  # 129+ violations in aprender-train — bulk fix planned
missing_debug_implementations = "allow"  # 128+ violations across workspace — bulk fix planned
missing_docs = "allow"  # We have doc coverage checks separately

# Best Practices
rust_2018_idioms = { level = "warn", priority = -1 }  # Lower priority to avoid conflicts
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_qualifications = "allow"  # Explicit paths sometimes preferred for clarity

[workspace.lints.clippy]
# Base level
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }

# Correctness (high priority)
checked_conversions = "warn"
missing_errors_doc = "allow"  # We have comprehensive error docs
missing_panics_doc = "allow"  # We document via expect() messages

# Performance
inefficient_to_string = "allow"  # Style preference - to_string() often clearer
explicit_iter_loop = "warn"
manual_ok_or = "warn"

# Style & Clarity
explicit_deref_methods = "warn"
implicit_clone = "warn"
inconsistent_struct_constructor = "warn"
redundant_closure_for_method_calls = "allow"  # Common pattern in iterators
unnested_or_patterns = "warn"
used_underscore_binding = "warn"

# Allow pedantic lints that conflict with mathematical notation or ML patterns
many_single_char_names = "allow"
cast_precision_loss = "allow"
cast_possible_truncation = "allow"  # Common in ML with dimension conversions
cast_possible_wrap = "allow"  # Common in ML algorithms
cast_sign_loss = "allow"  # Common in ML with usize/isize conversions
similar_names = "allow"
doc_markdown = "allow"
missing_const_for_fn = "allow"
module_name_repetitions = "allow"
must_use_candidate = "allow"
return_self_not_must_use = "allow"
float_cmp = "allow"  # ML algorithms often compare floats
unreadable_literal = "allow"  # Test data often has long numeric literals
items_after_statements = "allow"  # ML algorithms often need mid-function declarations
large_stack_arrays = "allow"  # ML tests often need large data arrays
too_many_arguments = "allow"  # ML training functions often need many parameters
too_many_lines = "allow"  # ML algorithms can be long
needless_range_loop = "allow"  # Explicit indexing often clearer in ML code
assigning_clones = "allow"  # Common pattern in state reset
missing_fields_in_debug = "allow"  # Some fields intentionally omitted
derivable_impls = "allow"  # Sometimes explicit impls are clearer
uninlined_format_args = "allow"  # Format string style preference
type_complexity = "allow"  # Complex types common in ML
cloned_instead_of_copied = "allow"  # Style preference
unused_self = "allow"  # Method stubs common during development
useless_vec = "allow"  # Test data often uses vec![] for clarity
manual_div_ceil = "allow"  # (x + n - 1) / n pattern is well-understood
manual_midpoint = "allow"  # (a + b) / 2.0 is standard mathematical notation in ML
map_unwrap_or = "allow"  # .map().unwrap_or() pattern common in tests
manual_range_contains = "allow"  # Explicit comparisons often clearer
empty_line_after_doc_comments = "allow"  # provable-contracts-macros proc macro generates these
empty_line_after_outer_attr = "allow"  # provable-contracts-macros proc macro generates these
approx_constant = "allow"  # Test data uses explicit values
match_wildcard_for_single_variants = "allow"  # Future-proofs against enum changes
single_char_pattern = "allow"  # Explicit string patterns preferred
field_reassign_with_default = "allow"  # Common in test configuration
assertions_on_constants = "allow"  # Used for compile-time checks
identity_op = "allow"  # 1 * 1 * 4 shows tensor dimensions (batch * seq * features)
unnecessary_literal_unwrap = "allow"  # Test code with known Ok values
default_trait_access = "allow"  # Default::default() vs Type::default() style preference
len_zero = "allow"  # Explicit .len() > 0 sometimes clearer in ML contexts
cast_lossless = "allow"  # Explicit casts preferred in ML code
cloned_ref_to_slice_refs = "allow"  # Style preference
clone_on_copy = "allow"  # Explicit clones for clarity
default_constructed_unit_structs = "allow"  # Style preference
erasing_op = "allow"  # x * 0 patterns in test data
excessive_precision = "allow"  # ML test data needs precise values
format_push_string = "allow"  # String building style preference
if_not_else = "allow"  # Style preference
manual_contains = "allow"  # Explicit iteration sometimes clearer
match_same_arms = "allow"  # Explicit matching for future-proofing
needless_borrows_for_generic_args = "allow"  # Style preference
needless_raw_string_hashes = "allow"  # Style preference
no_effect_underscore_binding = "allow"  # Used for documentation
overly_complex_bool_expr = "allow"  # Explicit logic sometimes clearer
stable_sort_primitive = "allow"  # Explicit sort stability
unnecessary_literal_bound = "allow"  # Style preference
unnecessary_map_or = "allow"  # Style preference
vec_init_then_push = "allow"  # Explicit initialization for clarity
nonminimal_bool = "allow"  # Complex booleans in mutation testing tests
trivially_copy_pass_by_ref = "allow"  # API consistency with &T for traits
bool_to_int_with_if = "allow"  # Explicit conversion often clearer
manual_let_else = "allow"  # Early returns common pattern
needless_pass_by_value = "allow"  # API consistency
ptr_arg = "allow"  # &PathBuf/&String in APIs for consistency
single_match_else = "allow"  # Explicit match often clearer than if let
const_is_empty = "allow"  # Compile-time empty checks for arrays
unnecessary_wraps = "allow"  # Result/Option wrappers for API consistency
ignore_without_reason = "allow"  # #[ignore] tests don't always need reasons
index_refutable_slice = "allow"  # Explicit indexing preferred in ML code
redundant_guards = "allow"  # Explicit guards for clarity in pattern matching
print_literal = "allow"  # Explicit format strings for documentation
unnecessary_debug_formatting = "allow"  # Debug formatting in tests
iter_cloned_collect = "allow"  # .iter().cloned().collect() pattern
semicolon_if_nothing_returned = "allow"  # Style preference

# ── Root package: `cargo install aprender` → `apr` binary ──
# The ML library lives in crates/aprender-core (lib name = "aprender").
# This root crate is the facade that provides `cargo install aprender`.

[package]
name = "aprender"
version = "0.30.0"
edition = "2021"
rust-version = "1.89"
authors = ["Noah Gift <noah@paiml.com>"]
license = "MIT"
description = "Next-generation ML framework in pure Rust — `cargo install aprender` for the `apr` CLI"
repository = "https://github.com/paiml/aprender"
homepage = "https://github.com/paiml/aprender"
documentation = "https://docs.rs/aprender"
keywords = ["machine-learning", "inference", "cli", "gpu", "simd"]
categories = ["command-line-utilities", "science"]
include = [
    "src/", "Cargo.toml", "README.md", "LICENSE",
    "crates/apr-cli/src/", "crates/apr-cli/Cargo.toml",
    "crates/aprender-core/src/", "crates/aprender-core/Cargo.toml",
    "crates/aprender-core/build.rs", "crates/aprender-core/build_*.rs",
    "crates/aprender-core/contracts/",
    "crates/aprender-core/README.md",
]

[[bin]]
name = "apr"
path = "src/bin/apr.rs"

[dependencies]
apr-cli = { path = "crates/apr-cli", version = "0.30.0", default-features = true }
# Core ML library (lib name = "aprender")
aprender_ml = { path = "crates/aprender-core", version = ">=0.29", package = "aprender-core" }

[lib]
name = "aprender"
path = "src/lib.rs"

# [patch.crates-io] — REMOVED
# RC4 fix: cc patch removed. The upstream fix shipped in cc 1.2.x.
# Contract: ci-infra-v1.yaml F-INFRA-004 — every patch must have tracking issue.