Registry / data / array-api-strict

array-api-strict

JSON →
library2.5pypypi✓ verified 89d ago

A strict, minimal implementation of the Python array API standard (version 2.5). Provides a reference implementation for the standard, enforcing the specification strictly. Has a maintenance release cadence with major updates approximately yearly.

pip install array-api-strict
INSTALL
IMPORT
SIG · ARRAY-API-STRICT
A
array-api-strict
datapythonv2.5
Install
3.6s avg
Import
279ms
Disk
90MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.268s · 90MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.6s · import 0.290s · 86MB
90MB installed
● package 90MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

as_strict_package
✓ import array_api_strict as xp
✗ import array_api_strict as xp; from array_api_strict import arange
Most users treat the package as a namespace (like numpy), not importing individual functions.
create_array
✓ import array_api_strict as xp; a = xp.asarray([1,2,3])
✗ from array_api_strict import array
The 'array' function is not directly exported; use 'asarray' instead.
linalg
✓ from array_api_strict.linalg import ...
✗ from array_api_strict import linalg
Submodules like 'linalg' are not part of the top-level namespace; must be imported explicitly.

Create two 1-D arrays and compute their dot product using the array API standard functions.

import array_api_strict as xp def main(): a = xp.asarray([1, 2, 3]) b = xp.asarray([4, 5, 6]) c = xp.dot(a, b) print(c) if __name__ == '__main__': main()
Debug
Known issues
breakingVersion 2.0 removed many previously included functions that are not part of the official array API standard (e.g., trigonometric functions from the 'math' extension). Use a full array library like NumPy for those.
fix
Migrate to NumPy or another array library for non-standard functions.
affects: >=2.0
breakingarray-api-strict enforces strict data type promotion rules. Mixed type operations (e.g., int32 + float64) may raise errors instead of promoting.
fix
Ensure inputs have the same dtype or convert explicitly using xp.asarray(..., dtype=xp.float64).
affects: all
deprecatedThe 'finfo' function returned 'numpy.finfo' objects in older versions; now returns array API 'finfo' objects. Access methods like 'eps' via attribute, not key.
fix
Use finfo_obj.eps instead of finfo_obj['eps'].
affects: >=1.0
gotchaIndexing semantics differ from NumPy: array_api_strict does not support advanced indexing that results in a copy vs view ambiguity. All indexing returns a copy (no views).
fix
Do not rely on views; assign modified copies back to the original array if needed.
affects: all
Errors
Common errors & fixes
AttributeError: module 'array_api_strict' has no attribute 'array'
array_api_strict does not export a function called 'array'; use 'asarray' instead.
fix
Replace xp.array(...) with xp.asarray(...).
ValueError: Data type casting violation
Mixed dtype operation that violates strict casting rules.
fix
Explicitly convert inputs to the same dtype: xp.asarray(a, dtype=xp.float64) + b.
AttributeError: module 'array_api_strict' has no attribute 'linalg'
Linear algebra submodule is not in top-level namespace; must be imported.
fix
Add 'from array_api_strict.linalg import ...' before using linalg functions.
Upgrade
Version history
2.5latest on PyPI · released Feb 23, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
array-api-strict — pip install array-api-strict · libregistry