bundles / numpy latest / docs
Doc
Array API standard compatibility
docs/reference:array_api
The NumPy 2.3.0 main namespace as well as the numpy.fft and numpy.linalg namespaces are compatible with the 2024.12 version of the Python array API standard.
NumPy aims to implement support for the future versions of the standard - assuming that those future versions can be upgraded to given NumPy's backwards compatibility policy <NEP23>.
For usage guidelines for downstream libraries and end users who want to write code that will work with both NumPy and other array libraries, we refer to the documentation of the array API standard itself and to code and developer-focused documentation in SciPy and scikit-learn.
Note that in order to use standard-complaint code with older NumPy versions (< 2.0), the array-api-compat package may be useful. For testing whether NumPy-using code is only using standard-compliant features rather than anything NumPy-specific, the array-api-strict package can be used.
Entry point
NumPy installs an entry point that can be used for discovery purposes
>>> from importlib.metadata import entry_points >>> entry_points(group='array_api', name='numpy') [EntryPoint(name='numpy', value='numpy', group='array_api')]
Note that leaving out name='numpy' will cause a list of entry points to be returned for all array API standard compatible implementations that installed an entry point.
With a few very minor exceptions, as documented in NEP 56 <NEP56>. The sum, prod and trace behavior adheres to the 2023.12 version instead, as do function signatures; the only known incompatibility that may remain is that the standard forbids unsafe casts for in-place operators while NumPy supports those.
Inspection
NumPy implements the array API inspection utilities. These functions can be accessed via the __array_namespace_info__() function, which returns a namespace containing the inspection utilities.
.. autosummary:: :toctree:generated __array_namespace_info__