Skip to main content

ndonnx

CI Documentation conda-forge pypi

An ONNX-backed array library that is compliant with the Array API standard.

Installation

Releases are available on PyPI and conda-forge.

# using pip
pip install ndonnx
# using conda
conda install ndonnx
# using pixi
pixi add ndonnx

Development

You can install the package in development mode using:

git clone https://github.com/quantco/ndonnx
cd ndonnx

# For Array API tests
git submodule update --init --recursive

pixi shell
pre-commit run -a
pip install --no-build-isolation --no-deps -e .
pytest tests -n auto

Quick start

ndonnx is an ONNX based python array library.

It has a couple of key features:

  • It implements the Array API standard. Standard compliant code can be executed without changes across numerous backends such as like NumPy, JAX and now ndonnx.

    import numpy as np
    import ndonnx as ndx
    import jax.numpy as jnp
    
    def mean_drop_outliers(a, low=-5, high=5):
        xp = a.__array_namespace__()
        return xp.mean(a[(low < a) & (a < high)])
    
    np_result = mean_drop_outliers(np.asarray([-10, 0.5, 1, 5]))
    jax_result = mean_drop_outliers(jnp.asarray([-10, 0.5, 1, 5]))
    onnx_result = mean_drop_outliers(ndx.asarray([-10, 0.5, 1, 5]))
    
    assert np_result == onnx_result.unwrap_numpy() == jax_result == 0.75
    
  • It supports ONNX export. This allows you persist your logic into an ONNX computation graph.

    import ndonnx as ndx
    import onnx
    
    # Instantiate placeholder ndonnx array
    x = ndx.array(shape=("N",), dtype=ndx.float32)
    y = mean_drop_outliers(x)
    
    # Build and save ONNX model to disk
    model = ndx.build({"x": x}, {"y": y})
    onnx.save(model, "mean_drop_outliers.onnx")
    

    You can then make predictions using a runtime of your choice.

    import onnxruntime as ort
    import numpy as np
    
    inference_session = ort.InferenceSession("mean_drop_outliers.onnx")
    prediction, = inference_session.run(None, {
        "x": np.array([-10, 0.5, 1, 5], dtype=np.float32),
    })
    assert prediction == 0.75
    

In the future we will be enabling a stable API for an extensible data type system. This will allow users to define their own data types and operations on arrays with these data types.

Array API coverage

Array API compatibility tested against the official array-api-tests suite. Missing coverage is tracked in the skips.txt file. Contributions are welcome!

Run the tests with:

pixi run arrayapitests

Metadata

Release files for ndonnx 0.23.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ndonnx 0.23.0
File Size Uploaded
ndonnx-0.23.0.tar.gz 354.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ndonnx 0.23.0
File Interpreter ABI Platform
ndonnx-0.23.0-py3-none-any.whl Python 3 none any Details

Total release size: 438.2 kB

Release files / ndonnx-0.23.0.tar.gz

Download URL ndonnx-0.23.0.tar.gz
Size 354.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3e7e2e0001f2a9c2a77e6ae191513d00bbc388dcca2ff13b8ed4a5cde5c302d1
BLAKE2b-256 checksum
How to use checksums
0294ee450d31b70aeeda0e1f0b4f369d17819ce8395b2bee2a3a4d456fa0505e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / ndonnx-0.23.0-py3-none-any.whl

Download URL ndonnx-0.23.0-py3-none-any.whl
Size 83.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9a7d3a69e0f48498fe0e82f51b6b66a2553eb0a4776b7373b03496557d8eba4
BLAKE2b-256 checksum
How to use checksums
c9a981c5ae589ea7a4b9525e3b24a5768964188740c489fe8751262b44e004a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.23.0 This release

2 release files

0.22.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.1

2 release files

0.17.4

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

1 release file

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page