From 4f62643b94cb3829f9e760748c85210482b58fe2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 30 Apr 2026 08:46:27 +0000 Subject: [PATCH] feat(deps): gate blake3/p64/fractal behind hpc-extras feature Make blake3, p64, and fractal optional dependencies pulled in only when the hpc-extras feature is enabled. hpc-extras is enabled by default so existing consumers see no change. Downstream crates (notably burn-ndarray) that only need the core array layer can opt out via: [dependencies] ndarray = { version = "0.17", default-features = false, features = ["std"] } This keeps cargo build (default) and cargo build --no-default-features both clean while removing ~200 transitive deps from minimal builds. Sprint A1 of burn-ndarray parity sprint. https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj --- Cargo.toml | 20 +++++++++++++++----- src/lib.rs | 6 +++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 05a8ce7c..8fc44d6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,9 +48,13 @@ cblas-sys = { workspace = true, optional = true } libc = { version = "0.2.82", optional = true } matrixmultiply = { version = "0.3.2", default-features = false, features=["cgemm"] } -blake3 = "1" -p64 = { path = "crates/p64" } -fractal = { path = "crates/fractal", default-features = false } + +# HPC extras — gated behind the `hpc-extras` feature so downstream consumers +# (e.g. burn-ndarray) can opt out of the heavy compile tree when only the core +# array layer is needed. Enabled by default to preserve existing behavior. +blake3 = { version = "1", optional = true } +p64 = { path = "crates/p64", optional = true } +fractal = { path = "crates/fractal", default-features = false, optional = true } serde = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } rawpointer = { version = "0.2" } @@ -73,7 +77,7 @@ itertools = { workspace = true } ndarray-gen = { workspace = true } [features] -default = ["std"] +default = ["std", "hpc-extras"] # Enable blas usage # See README for more instructions @@ -81,9 +85,15 @@ blas = ["dep:cblas-sys", "dep:libc"] serde = ["dep:serde"] -std = ["num-traits/std", "matrixmultiply/std", "fractal/std"] +std = ["num-traits/std", "matrixmultiply/std"] rayon = ["dep:rayon", "std"] +# HPC extras: blake3 hashing, p64 palette/NARS bridge, fractal manifold. +# These pull in a non-trivial dependency tree; downstream crates such as +# burn-ndarray that only need the core array layer can disable this with +# `default-features = false` (and re-enable `std` explicitly if needed). +hpc-extras = ["std", "dep:blake3", "dep:p64", "dep:fractal", "fractal/std"] + matrixmultiply-threading = ["matrixmultiply/threading"] # JITSON: JSON parser + validator + template + scan pipeline (no Cranelift) diff --git a/src/lib.rs b/src/lib.rs index 40218807..596f3616 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -257,7 +257,11 @@ pub mod simd_wasm; pub mod backend; /// HPC extensions ported from rustynum: BLAS, statistics, HDC, CogRecord, FFT, LAPACK. -#[cfg(feature = "std")] +/// +/// Gated behind the `hpc-extras` feature (enabled by default) because the +/// module pulls in `blake3`, `p64`, and `fractal`. Disable default features to +/// drop those dependencies (e.g. burn-ndarray's polyfill-only build). +#[cfg(feature = "hpc-extras")] #[allow( clippy::all, unused_imports,