Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

pipekit-array Design Doc

A thin layer of duck-typed array operators on top of pipekit-ops, written against the Python Array API standard, so a single operator runs on NumPy, JAX, CuPy, PyTorch or dask without a rewrite.

Status

pipekit-array 0.3.1 ships most of this design. Since ADR A30 the package is six areas (arrays, named, kernels, operators, bridges, testing), described in Architecture §3; the module names of the v0.1 catalogue below are the plan’s, not the package’s.

PartStatus
Namespace dispatch (array_namespace), MeanScalar, StackAlong, ConcatenateAlongtoday (phase A)
Named carriers (DimArray) and every dim-level function of Dim-level functions: the missing ones, with operator twinstoday (#204 to #207)
ApplyAlong (replaces ApplyToBands) and BatchAlong (replaces the array-shaped BatchedMap)today (#206)
batch / Padded, to_rows / from_rows, Estimator, the einx bridge, KernelOp, the xarray adapter, the test kittoday
Subsampleretired: it is isel with a stepped slice (A15)
Histogram (array-aware), AssertClose, AssertValueRange, AssertNoNaN, AssertValidFraction, ModelOpnot built
The weight-blob model wrappers of ADR A8today, outside pipekit-array: pipekit_jax.JaxModelOp, and EquinoxModelOp and KerasModelOp in pipekit-train

Structure

docs/design/
├── README.md             # This file: index and reading order.
├── vision.md             # Motivation, scope, the Array API bet.
├── architecture.md       # The dispatch pattern and how operators
│                         # delegate to array_namespace(x).
├── decisions.md          # ADRs A1 to A30 (dispatch, scope vs core,
│                         # backend extras, named carriers, the
│                         # dim-level functions).
├── boundaries.md         # Non-goals, open questions, v0.1 DoD.
└── api/
    ├── README.md         # Operator catalogue: at-a-glance table.
    ├── operators.md      # Layer 1: data-flow ops (ApplyAlong,
    │                     # StackAlong, ConcatenateAlong, Subsample,
    │                     # MeanScalar, BatchAlong, Histogram).
    ├── qc.md             # Layer 2: numeric QC (AssertClose,
    │                     # AssertValueRange, AssertNoNaN,
    │                     # AssertValidFraction).
    ├── inference.md      # Layer 3: ModelOp (framework-agnostic
    │                     # inference; numpy / JAX / torch / Keras).
    └── dim_functions.md  # The dim-level functions (rename,
                          # merge_dims, shift, window, quantile, dot, …)
                          # and their xarray parity table.

Reading order

  1. Vision: why a dedicated array layer at all, and what the Array API gives us for free.

  2. Architecture: the array_namespace dispatch pattern, the four shape rules every operator follows, and how pipekit-array slots between pipekit-ops and the domain libraries (geotoolz, xr_toolz).

  3. Decisions (ADRs): the ADRs that lock the shape in.

  4. API: operator catalogue, then operators, qc, inference and dim_functions.

  5. Boundaries: what is deferred and why.

Sources

The design brings together two upstream sources:

Where the two sources diverge, this design resolves the tension explicitly in Decisions (ADRs).