--- id: array-api-compat version: "1.15.0" license: MIT license_treatment: permissive maintenance: active --- # array-api-compat — A wrapper around NumPy and other array libraries to make them compatible with the Array API standard License: permissive · Maintenance: active · Downloads: 2.3M/mo ## What it is and what it does array-api-compat is a lightweight wrapper that lets you write array code once and run it against multiple array libraries—NumPy, CuPy, PyTorch, Dask, JAX, ndonnx, and sparse—all through a single standardized interface defined by the Array API standard. It abstracts away library-specific quirks and naming differences so your code doesn't need conditional imports or branching logic for different backends. The package has no runtime dependencies of its own and is designed to be a thin compatibility layer. You import from it instead of directly from your array library, and it delegates to whichever backend you're using. This is useful when building libraries or applications that need to support multiple array backends without duplicating logic, or when you want to let users choose their preferred array library without rewriting your code. Use it for: - Build a scientific library that works with NumPy, CuPy, PyTorch, Dask, JAX, ndonnx, and sparse without maintaining separate code paths for each. - Write code that can run on CPU or GPU by swapping the array backend without changing operations. - Create a machine learning framework that accepts arrays from any supported library and processes them uniformly. - Migrate code between array libraries by changing only the import statement, not the operations themselves. - Develop educational materials or examples that work across multiple array libraries without duplication. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a unified wrapper around NumPy, CuPy, PyTorch, Dask, JAX, ndonnx, and sparse that implements the Array API standard, allowing code to work consistently across different array libraries. Yes, if you are building a library or application that needs to support multiple array backends. The package is actively maintained, has no external dependencies, and MIT-licensed. Install it if you want to write array code once and let users choose their backend; skip it if you are locked to a single array library. ## Install pip install array-api-compat uv add array-api-compat poetry add array-api-compat ## Installing array-api-compat Before you install: Low friction install with no runtime dependencies. Actively maintained with a recent release and steady commit activity. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations. Quickstart: pip install array-api-compat # Then import and use with your chosen array library import array_api_compat Requires Python 3.10 or later; the underlying array library (NumPy, CuPy, PyTorch, Dask, JAX, ndonnx, or sparse) must be installed separately. Verify before relying: - Whether the wrapper introduces measurable performance overhead compared to direct library calls - Coverage completeness: which Array API operations are fully supported versus partially implemented across all supported libraries - How to select or switch between supported array backends at runtime ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 2.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags array api standard wrapper, numpy pytorch compatibility layer, array library abstraction, unified array interface, cross-library array api, array api compliance, standardized array operations, array-api-standard, multi-backend, interoperability [View on SkillFed](https://skillfed.io/packages/array-api-compat) · [View on PyPI](https://pypi.org/project/array-api-compat/)