8000 Merge pull request #18585 from data-apis/array-api · numpy/numpy@098f874 · GitHub
[go: up one dir, main page]

Skip to content

Commit 098f874

Browse files
authored
Merge pull request #18585 from data-apis/array-api
ENH: Implementation of the NEP 47 (adopting the array API standard)
2 parents a3ac75c + 7091e4c commit 098f874

24 files changed

+3717
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Implementation of the NEP 47 (adopting the array API standard)
2+
--------------------------------------------------------------
3+
4+
An initial implementation of `NEP 47`_ (adoption the array API standard) has
5+
been added as ``numpy.array_api``. The implementation is experimental and will
6+
issue a UserWarning on import, as the `array API standard
7+
<https://data-apis.org/array-api/latest/index.html>`_ is still in draft state.
8+
``numpy.array_api`` is a conforming implementation of the array API standard,
9+
which is also minimal, meaning that only those functions and behaviors that
10+
are required by the standard are implemented (see the NEP for more info).
11+
Libraries wishing to make use of the array API standard are encouraged to use
12+
``numpy.array_api`` to check that they are only using functionality that is
13+
guaranteed to be present in standard conforming implementations.
14+
15+
.. _`NEP 47`: https://numpy.org/neps/nep-0047-array-api-standard.html

numpy/_pytesttester.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,20 @@ def __call__(self, label='fast', verbose=1, extra_argv=None,
137137
# offset verbosity. The "-q" cancels a "-v".
138138
pytest_args += ["-q"]
139139

140-
# Filter out distutils cpu warnings (could be localized to
141-
# distutils tests). ASV has problems with top level import,
142-
# so fetch module for suppression here.
143140
with warnings.catch_warnings():
144141
warnings.simplefilter("always")
142+
# Filter out distutils cpu warnings (could be localized to
143+
# distutils tests). ASV has problems with top level import,
144+
# so fetch module for suppression here.
145145
from numpy.distutils import cpuinfo
146146

147+
with warnings.catch_warnings(record=True):
148+
# Ignore the warning from importing the array_api submodule. This
149+
# warning is done on import, so it would break pytest collection,
150+
# but importing it early here prevents the warning from being
151+
# issued when it imported again.
152+
import numpy.array_api
153+
147154
# Filter out annoying import messages. Want these in both develop and
148155
# release mode.
149156
pytest_args += [

0 commit comments

Comments
 (0)
0