Skip to main content

Crate ferray_numpy_interop

Crate ferray_numpy_interop 

Source
Expand description

§ferray-numpy-interop

A companion crate providing zero-copy (where possible) conversions between ferray arrays and external array ecosystems:

  • NumPy (via PyO3) — feature "python"
  • Apache Arrow — feature "arrow"
  • Polars — feature "polars"

All three backends are feature-gated and disabled by default. Enable them in your Cargo.toml:

[dependencies.ferray-numpy-interop]
version = "0.1"
features = ["arrow"]  # or "python", "polars"

§Design principles

  1. Safety first — every conversion validates dtypes and memory layout before returning. No silent reinterpretation of memory.
  2. Zero-copy when possible — C-contiguous arrays are shared without copying where the target format supports it.
  3. Explicit errors — dtype mismatches, null values, and unsupported types produce clear FerrayError messages.

Modules§

dtype_map
Mapping between ferray [DType], Arrow [DataType], and NumPy dtype codes.