Skip to content

Commit 48a9041

Browse files
committed
Deploying to gh-pages from @ eced421 🚀
1 parent e5070b6 commit 48a9041

File tree

9 files changed

+153
-71
lines changed

9 files changed

+153
-71
lines changed

_sources/api.rst.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ API Reference
33

44
.. automodule:: array_api_strict
55

6+
.. _array-api-strict-flags:
7+
68
Array API Strict Flags
79
----------------------
810

@@ -11,6 +13,7 @@ Array API Strict Flags
1113
.. currentmodule:: array_api_strict
1214

1315
.. autofunction:: get_array_api_strict_flags
16+
1417
.. autofunction:: set_array_api_strict_flags
1518
.. autofunction:: reset_array_api_strict_flags
1619
.. autoclass:: ArrayAPIStrictFlags

_sources/changelog.md.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Changelog
22

3+
## 2.0 (2024-06-27)
4+
5+
### Major Changes
6+
7+
- array-api-strict has a new set of [flags](array-api-strict-flags) that can
8+
be used to dynamically enable or disable features in array-api-strict. These
9+
flags allow you to change the supported array API version, enable or disable
10+
[extensions](https://data-apis.org/array-api/latest/extensions/index.html),
11+
enable or disable features that rely on data-dependent shapes, and enable or
12+
disable boolean indexing. Future versions may add additional flags to allow
13+
changing other optional or varying behaviors in the standard.
14+
15+
- Added experimental support for the
16+
[2023.12](https://data-apis.org/array-api/2023.12/changelog.html#v2023-12)
17+
version of the array API standard. The default version is still 2022.12, but
18+
the version can be changed to 2023.12 using the aforementioned flags, either
19+
by calling
20+
{func}`array_api_strict.set_array_api_strict_flags(api_version='2023.12')
21+
<array_api_strict.set_array_api_strict_flags>` or setting the environment
22+
variable {envvar}`ARRAY_API_STRICT_API_VERSION=2023.12
23+
<ARRAY_API_STRICT_API_VERSION>`. A future version of array-api-strict will
24+
change the default version to 2023.12.
25+
26+
### Minor Changes
27+
28+
- Calling `iter()` on an array now correctly raises `TypeError`.
29+
30+
- Add some missing names to `__all__`.
31+
332
## 1.1.1 (2024-04-29)
433

534
- Fix the `api_version` argument to `__array_namespace__` to accept

_sources/index.md.txt

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ libraries. Consuming library code should use the
1515
support the array API. Rather, it is intended to be used in the test suites of
1616
consuming libraries to test their array API usage.
1717

18-
array-api-strict currently supports the 2022.12 version of the standard.
19-
2023.12 support is planned and is tracked by [this
20-
issue](https://github.com/data-apis/array-api-strict/issues/25).
18+
array-api-strict currently supports the
19+
[2022.12](https://data-apis.org/array-api/latest/changelog.html#v2022-12)
20+
version of the standard. Experimental
21+
[2023.12](https://data-apis.org/array-api/latest/changelog.html#v2023-12)
22+
support is implemented, [but must be enabled with a
23+
flag](array-api-strict-flags).
2124

2225
## Install
2326

@@ -34,7 +37,7 @@ and [Conda-forge](https://anaconda.org/conda-forge/array-api-strict)
3437
conda install --channel conda-forge array-api-strict
3538
```
3639

37-
array-api-strict supports NumPy 1.26 and (the upcoming) NumPy 2.0.
40+
array-api-strict supports NumPy 1.26 and NumPy 2.0.
3841

3942
## Rationale
4043

@@ -106,7 +109,7 @@ strict/minimal:
106109
like `sin` will accept integer array inputs, but the [standard only requires
107110
them to accept floating-point
108111
inputs](https://data-apis.org/array-api/latest/API_specification/generated/array_api.sin.html#array_api.sin),
109-
so in array-api-strict, `sin(integer_array)` will raise an exception.
112+
so in array-api-strict, `sin(asarray(0))` will raise an exception.
110113

111114
- The
112115
[indexing](https://data-apis.org/array-api/latest/API_specification/indexing.html)
@@ -128,6 +131,12 @@ strict/minimal:
128131
functions](https://data-apis.org/array-api/latest/API_specification/creation_functions.html)
129132
such as `asarray`.
130133

134+
- Optional behavior such as [optional
135+
extensions](https://data-apis.org/array-api/latest/extensions/index.html),
136+
functions that use data-dependent shapes, and boolean indexing are enabled
137+
by default but can disabled with the [array-api-strict
138+
flags](array-api-strict-flags).
139+
131140
## Caveats
132141

133142
array-api-strict is a thin pure Python wrapper around NumPy. NumPy 2.0 fully
@@ -167,21 +176,13 @@ issue, but this hasn't necessarily been tested thoroughly.
167176
this deviation may be tested with type checking. This [behavior may improve
168177
in the future](https://github.com/data-apis/array-api-strict/issues/6).
169178

170-
5. There are some behaviors in the standard that are not required to be
171-
implemented by libraries that cannot support [data dependent
172-
shapes](https://data-apis.org/array-api/latest/design_topics/data_dependent_output_shapes.html).
173-
This includes [the `unique_*`
174-
functions](https://data-apis.org/array-api/latest/API_specification/set_functions.html),
175-
[boolean array
176-
indexing](https://data-apis.org/array-api/latest/API_specification/indexing.html#boolean-array-indexing),
177-
and the
178-
[`nonzero`](https://data-apis.org/array-api/latest/API_specification/generated/array_api.nonzero.html)
179-
function. array-api-strict currently implements all of these. In the
180-
future, [there may be a way to disable them](https://github.com/data-apis/array-api-strict/issues/7).
181-
182-
6. array-api-strict currently only supports the 2022.12 version of the array
183-
API standard. [Support for 2023.12 is
184-
planned](https://github.com/data-apis/array-api-strict/issues/25).
179+
5. array-api-strict currently uses the 2022.12 version of the array API
180+
standard by default. Support for 2023.12 is implemented but is still
181+
experimental and not fully tested. It can be enabled with
182+
{func}`array_api_strict.set_array_api_strict_flags(api_version='2023.12')
183+
<array_api_strict.set_array_api_strict_flags>` or by setting the
184+
environment variable {envvar}`ARRAY_API_STRICT_API_VERSION=2023.12
185+
<ARRAY_API_STRICT_API_VERSION>`.
185186

186187
(numpy.array_api)=
187188
## Relationship to `numpy.array_api`

api.html

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
support the array API. Rather, it is intended to be used in the test suites of
272272
consuming libraries to test their array API usage.</p>
273273
<section id="module-array_api_strict._flags">
274-
<span id="array-api-strict-flags"></span><h2>Array API Strict Flags<a class="headerlink" href="#module-array_api_strict._flags" title="Link to this heading"></a></h2>
274+
<span id="id1"></span><span id="array-api-strict-flags"></span><h2>Array API Strict Flags<a class="headerlink" href="#module-array_api_strict._flags" title="Link to this heading"></a></h2>
275275
<p>These functions configure global flags that allow array-api-strict to be
276276
used in different “modes”. These modes include</p>
277277
<ul class="simple">
@@ -291,6 +291,13 @@
291291
<p>This function is <strong>not</strong> part of the array API standard. It only exists
292292
in array-api-strict.</p>
293293
</div>
294+
<div class="admonition note">
295+
<p class="admonition-title">Note</p>
296+
<p>The <a class="reference external" href="https://data-apis.org/array-api/latest/API_specification/inspection.html">inspection API</a>
297+
provides a portable way to access most of this information. However, it
298+
is only present in standard versions starting with 2023.12. The array
299+
API version can be accessed portably using <code class="code docutils literal notranslate"><span class="pre">xp.__array_api_version__</span></code>.</p>
300+
</div>
294301
<dl class="field-list simple">
295302
<dt class="field-odd">Returns<span class="colon">:</span></dt>
296303
<dd class="field-odd"><p><em>dict</em> – A dictionary containing the current array-api-strict flags.</p>
@@ -326,46 +333,52 @@
326333
<dd><p>Set the array-api-strict flags to the specified values.</p>
327334
<p>Flags are global variables that enable or disable array-api-strict
328335
behaviors.</p>
336+
<p>The flags can also be changed by setting <a class="reference internal" href="#environment-variables"><span class="std std-ref">environment variables</span></a>.</p>
329337
<div class="admonition note">
330338
<p class="admonition-title">Note</p>
331339
<p>This function is <strong>not</strong> part of the array API standard. It only exists
332340
in array-api-strict.</p>
333341
</div>
334-
<ul>
335-
<li><p><code class="code docutils literal notranslate"><span class="pre">api_version</span></code>: The version of the standard to use. Supported
336-
versions are: <code class="docutils literal notranslate"><span class="pre">('2021.12',</span> <span class="pre">'2022.12')</span></code>. The default version number is
342+
<dl class="field-list">
343+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
344+
<dd class="field-odd"><ul>
345+
<li><p><strong>api_version</strong> (<em>str, optional</em>) – The version of the standard to use. Supported versions are:
346+
<code class="docutils literal notranslate"><span class="pre">('2021.12',</span> <span class="pre">'2022.12',</span> <span class="pre">'2023.12')</span></code>. The default version number is
337347
<code class="docutils literal notranslate"><span class="pre">'2022.12'</span></code>.</p>
338348
<p>Note that 2021.12 is supported, but currently gives the same thing as
339349
2022.12 (except that the fft extension will be disabled).</p>
350+
<p>2023.12 support is experimental. Some features in 2023.12 may still be
351+
missing, and it hasn’t been fully tested. A future version of
352+
array-api-strict will change the default version to 2023.12.</p>
340353
</li>
341-
<li><p><code class="code docutils literal notranslate"><span class="pre">boolean_indexing</span></code>: Whether indexing by a boolean array is supported.
342-
Note that although boolean array indexing does result in data-dependent
343-
shapes, this flag is independent of the <code class="code docutils literal notranslate"><span class="pre">data_dependent_shapes</span></code> flag
344-
(see below).</p></li>
345-
<li><p><code class="code docutils literal notranslate"><span class="pre">data_dependent_shapes</span></code>: Whether data-dependent shapes are enabled in
346-
array-api-strict.</p>
347-
<p>This flag is enabled by default. Array libraries that use computation
354+
<li><p><strong>boolean_indexing</strong> (<em>bool, optional</em>) – Whether indexing by a boolean array is supported.
355+
Note that although boolean array indexing does result in
356+
data-dependent shapes, this flag is independent of the
357+
<code class="code docutils literal notranslate"><span class="pre">data_dependent_shapes</span></code> flag (see below).</p></li>
358+
<li><p><strong>data_dependent_shapes</strong> (<em>bool, optional</em>) – Whether data-dependent shapes are enabled in array-api-strict.
359+
This flag is enabled by default. Array libraries that use computation
348360
graphs may not be able to support functions whose output shapes depend
349361
on the input data.</p>
350362
<p>The functions that make use of data-dependent shapes, and are therefore
351363
disabled by setting this flag to False are</p>
352364
<ul class="simple">
353-
<li><p><code class="code docutils literal notranslate"><span class="pre">unique_all</span></code>, <code class="code docutils literal notranslate"><span class="pre">unique_counts</span></code>, <code class="code docutils literal notranslate"><span class="pre">unique_inverse</span></code>, and <code class="code docutils literal notranslate"><span class="pre">unique_values</span></code>.</p></li>
354-
<li><p><code class="code docutils literal notranslate"><span class="pre">nonzero</span></code></p></li>
355-
<li><p><code class="code docutils literal notranslate"><span class="pre">repeat</span></code> when the <code class="code docutils literal notranslate"><span class="pre">repeats</span></code> argument is an array (requires 2023.12
356-
version of the standard)</p></li>
365+
<li><p><code class="code docutils literal notranslate"><span class="pre">unique_all()</span></code>, <code class="code docutils literal notranslate"><span class="pre">unique_counts()</span></code>, <code class="code docutils literal notranslate"><span class="pre">unique_inverse()</span></code>, and <code class="code docutils literal notranslate"><span class="pre">unique_values()</span></code>.</p></li>
366+
<li><p><code class="code docutils literal notranslate"><span class="pre">nonzero()</span></code></p></li>
367+
<li><p><code class="code docutils literal notranslate"><span class="pre">repeat()</span></code> when the <code class="code docutils literal notranslate"><span class="pre">repeats</span></code> argument is an array (requires the
368+
2023.12 version of the standard)</p></li>
357369
</ul>
358370
<p>Note that while boolean indexing is also data-dependent, it is
359371
controlled by a separate <code class="code docutils literal notranslate"><span class="pre">boolean_indexing</span></code> flag (see above).</p>
360372
<p>See
361373
<a class="reference external" href="https://data-apis.org/array-api/latest/design_topics/data_dependent_output_shapes.html">https://data-apis.org/array-api/latest/design_topics/data_dependent_output_shapes.html</a>
362374
for more details.</p>
363375
</li>
364-
<li><p><code class="code docutils literal notranslate"><span class="pre">enabled_extensions</span></code>: A list of extensions that are enabled in
365-
array-api-strict. The default is <code class="docutils literal notranslate"><span class="pre">('linalg',</span> <span class="pre">'fft')</span></code>. Note that
366-
some extensions require a minimum version of the standard.</p></li>
376+
<li><p><strong>enabled_extensions</strong> (<em>list of str, optional</em>) – A list of extensions that are enabled in array-api-strict. The default
377+
is <code class="docutils literal notranslate"><span class="pre">('linalg',</span> <span class="pre">'fft')</span></code>. Note that some extensions require a
378+
minimum version of the standard.</p></li>
367379
</ul>
368-
<p>The flags can also be changed by setting <a class="reference internal" href="#environment-variables"><span class="std std-ref">environment variables</span></a>.</p>
380+
</dd>
381+
</dl>
369382
<p class="rubric">Examples</p>
370383
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">array_api_strict</span> <span class="kn">import</span> <span class="n">set_array_api_strict_flags</span>
371384
</pre></div>
@@ -451,7 +464,7 @@
451464
</dd></dl>
452465

453466
<section id="environment-variables">
454-
<span id="id1"></span><h3>Environment Variables<a class="headerlink" href="#environment-variables" title="Link to this heading"></a></h3>
467+
<span id="id2"></span><h3>Environment Variables<a class="headerlink" href="#environment-variables" title="Link to this heading"></a></h3>
455468
<p>Flags can also be set with environment variables.
456469
<a class="reference internal" href="#array_api_strict.set_array_api_strict_flags" title="array_api_strict.set_array_api_strict_flags"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_array_api_strict_flags()</span></code></a> will override the values set by environment
457470
variables. Note that the environment variables will only change the defaults

changelog.html

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,44 @@
259259
<section class="tex2jax_ignore mathjax_ignore" id="changelog">
260260
<h1>Changelog<a class="headerlink" href="#changelog" title="Link to this heading"></a></h1>
261261
<section id="id1">
262-
<h2>1.1.1 (2024-04-29)<a class="headerlink" href="#id1" title="Link to this heading"></a></h2>
262+
<h2>2.0 (2024-06-27)<a class="headerlink" href="#id1" title="Link to this heading"></a></h2>
263+
<section id="major-changes">
264+
<h3>Major Changes<a class="headerlink" href="#major-changes" title="Link to this heading"></a></h3>
265+
<ul class="simple">
266+
<li><p>array-api-strict has a new set of <a class="reference internal" href="api.html#array-api-strict-flags"><span class="std std-ref">flags</span></a> that can
267+
be used to dynamically enable or disable features in array-api-strict. These
268+
flags allow you to change the supported array API version, enable or disable
269+
<a class="reference external" href="https://data-apis.org/array-api/latest/extensions/index.html">extensions</a>,
270+
enable or disable features that rely on data-dependent shapes, and enable or
271+
disable boolean indexing. Future versions may add additional flags to allow
272+
changing other optional or varying behaviors in the standard.</p></li>
273+
<li><p>Added experimental support for the
274+
<a class="reference external" href="https://data-apis.org/array-api/2023.12/changelog.html#v2023-12">2023.12</a>
275+
version of the array API standard. The default version is still 2022.12, but
276+
the version can be changed to 2023.12 using the aforementioned flags, either
277+
by calling
278+
<a class="reference internal" href="api.html#array_api_strict.set_array_api_strict_flags" title="array_api_strict.set_array_api_strict_flags"><code class="xref py py-func docutils literal notranslate"><span class="pre">array_api_strict.set_array_api_strict_flags(api_version='2023.12')</span></code></a> or setting the environment
279+
variable <span class="target" id="index-0"></span><a class="reference internal" href="api.html#envvar-ARRAY_API_STRICT_API_VERSION"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">ARRAY_API_STRICT_API_VERSION=2023.12</span></code></a>. A future version of array-api-strict will
280+
change the default version to 2023.12.</p></li>
281+
</ul>
282+
</section>
283+
<section id="minor-changes">
284+
<h3>Minor Changes<a class="headerlink" href="#minor-changes" title="Link to this heading"></a></h3>
285+
<ul class="simple">
286+
<li><p>Calling <code class="docutils literal notranslate"><span class="pre">iter()</span></code> on an array now correctly raises <code class="docutils literal notranslate"><span class="pre">TypeError</span></code>.</p></li>
287+
<li><p>Add some missing names to <code class="docutils literal notranslate"><span class="pre">__all__</span></code>.</p></li>
288+
</ul>
289+
</section>
290+
</section>
291+
<section id="id2">
292+
<h2>1.1.1 (2024-04-29)<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
263293
<ul class="simple">
264294
<li><p>Fix the <code class="docutils literal notranslate"><span class="pre">api_version</span></code> argument to <code class="docutils literal notranslate"><span class="pre">__array_namespace__</span></code> to accept
265295
<code class="docutils literal notranslate"><span class="pre">'2021.12'</span></code> or <code class="docutils literal notranslate"><span class="pre">'2022.12'</span></code>.</p></li>
266296
</ul>
267297
</section>
268-
<section id="id2">
269-
<h2>1.1 (2024-04-08)<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
298+
<section id="id3">
299+
<h2>1.1 (2024-04-08)<a class="headerlink" href="#id3" title="Link to this heading"></a></h2>
270300
<ul class="simple">
271301
<li><p>Fix the <code class="docutils literal notranslate"><span class="pre">copy</span></code> flag in <code class="docutils literal notranslate"><span class="pre">__array__</span></code> for NumPy 2.0.</p></li>
272302
<li><p>Add full <code class="docutils literal notranslate"><span class="pre">copy=False</span></code> support to <code class="docutils literal notranslate"><span class="pre">asarray()</span></code>. This is emulated in NumPy 1.26 by creating
@@ -275,8 +305,8 @@ <h2>1.1 (2024-04-08)<a class="headerlink" href="#id2" title="Link to this headin
275305
<li><p>Add broadcasting support to <code class="docutils literal notranslate"><span class="pre">cross</span></code>.</p></li>
276306
</ul>
277307
</section>
278-
<section id="id3">
279-
<h2>1.0 (2024-01-24)<a class="headerlink" href="#id3" title="Link to this heading"></a></h2>
308+
<section id="id4">
309+
<h2>1.0 (2024-01-24)<a class="headerlink" href="#id4" title="Link to this heading"></a></h2>
280310
<p>This is the first release of <code class="docutils literal notranslate"><span class="pre">array_api_strict</span></code>. It is extracted from
281311
<code class="docutils literal notranslate"><span class="pre">numpy.array_api</span></code>, which was included as an experimental submodule in NumPy
282312
versions prior to 2.0. Note that the commit history in this repository is
@@ -360,9 +390,14 @@ <h2>1.0 (2024-01-24)<a class="headerlink" href="#id3" title="Link to this headin
360390
<div class="toc-tree">
361391
<ul>
362392
<li><a class="reference internal" href="#">Changelog</a><ul>
363-
<li><a class="reference internal" href="#id1">1.1.1 (2024-04-29)</a></li>
364-
<li><a class="reference internal" href="#id2">1.1 (2024-04-08)</a></li>
365-
<li><a class="reference internal" href="#id3">1.0 (2024-01-24)</a></li>
393+
<li><a class="reference internal" href="#id1">2.0 (2024-06-27)</a><ul>
394+
<li><a class="reference internal" href="#major-changes">Major Changes</a></li>
395+
<li><a class="reference internal" href="#minor-changes">Minor Changes</a></li>
396+
</ul>
397+
</li>
398+
<li><a class="reference internal" href="#id2">1.1.1 (2024-04-29)</a></li>
399+
<li><a class="reference internal" href="#id3">1.1 (2024-04-08)</a></li>
400+
<li><a class="reference internal" href="#id4">1.0 (2024-01-24)</a></li>
366401
</ul>
367402
</li>
368403
</ul>

0 commit comments

Comments
 (0)