Skip to content

Commit 217a519

Browse files
committed
Fix autosummary by patching stub sub-modules in conf.py
1 parent b19d021 commit 217a519

16 files changed

+1038
-32
lines changed

spec/2021.12/API_specification/data_types.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ Double-precision (128-bit) complex floating-point number whose real and imaginar
7777

7878
Accordingly, subnormal behavior is left unspecified and, thus, implementation-defined. Conforming implementations may vary in their support for subnormal numbers.
7979

80+
.. admonition:: Future extension
81+
:class: admonition tip
82+
83+
``complex64`` and ``complex128`` data types are expected to be included in the next version of this standard and to have the following casting rules (will be added to :ref:`type-promotion`):
84+
85+
.. image:: ../../_static/images/dtype_promotion_complex.png
86+
87+
See `array-api/issues/102 <https://github.com/data-apis/array-api/issues/102>`_ for more details
88+
8089
.. note::
8190
A conforming implementation of the array API standard may provide and support additional data types beyond those described in this specification.
8291

spec/2021.12/API_specification/type_promotion.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Type Promotion Rules
77

88
Type promotion rules can be understood at a high level from the following diagram:
99

10-
.. image:: /_static/images/dtype_promotion_lattice.png
10+
.. image:: ../../_static/images/dtype_promotion_lattice.png
1111
:target: Type promotion diagram
1212

1313
*Type promotion diagram. Promotion between any two types is given by their join on this lattice. Only the types of participating arrays matter, not their values. Dashed lines indicate that behavior for Python scalars is undefined on overflow. Boolean, integer and floating-point dtypes are not connected, indicating mixed-kind promotion is undefined.*

spec/2021.12/assumptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ such a coupling. Facilitation support of multiple array types in downstream
3535
libraries is an important use case however, the assumed dependency structure
3636
for that is:
3737

38-
![dependency assumptions diagram](_static/images/dependency_assumption_diagram.png)
38+
![dependency assumptions diagram](../_static/images/dependency_assumption_diagram.png)
3939

4040
Array libraries may know how to interoperate with each other, for example by
4141
constructing their own array type from that of another library or by shared

spec/2021.12/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
3+
from array_api_stubs import _2021_12 as stubs_mod
4+
from _array_api_conf import *
5+
6+
release = "2021.12"
7+
sys.modules["array_api"] = stubs_mod

spec/2021.12/purpose_and_scope.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Furthermore, meta-topics included in this standard include:
111111
The concrete set of functionality that is in scope for this version of the
112112
standard is shown in this diagram:
113113

114-
![Scope of array API](_static/images/scope_of_array_API.png)
114+
![Scope of array API](../_static/images/scope_of_array_API.png)
115115

116116

117117
**Goals** for the API standard include:

spec/2022.12/assumptions.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
(Assumptions)=
2+
3+
# Assumptions
4+
5+
## Hardware and software environments
6+
7+
No assumptions on a specific hardware environment are made. It must be possible
8+
to create an array library adhering to this standard that runs (efficiently) on
9+
a variety of different hardware: CPUs with different architectures, GPUs,
10+
distributed systems and TPUs and other emerging accelerators.
11+
12+
The same applies to software environments: it must be possible to create an
13+
array library adhering to this standard that runs efficiently independent of
14+
what compilers, build-time or run-time execution environment, or distribution
15+
and install method is employed. Parallel execution, JIT compilation, and
16+
delayed (lazy) evaluation must all be possible.
17+
18+
The variety of hardware and software environments puts _constraints_ on choices
19+
made in the API standard. For example, JIT compilers may require output dtypes
20+
of functions to be predictable from input dtypes only rather than input values.
21+
22+
23+
(assumptions-dependencies)=
24+
25+
## Dependencies
26+
27+
The only dependency that's assumed in this standard is that on Python itself.
28+
Python >= 3.8 is assumed, motivated by the use of positional-only parameters
29+
(see [function and method signatures](API_specification/function_and_method_signatures.md)).
30+
31+
Importantly, array libraries are not assumed to be aware of each other, or of
32+
a common array-specific layer. The [use cases](use_cases.md) do not require
33+
such a dependency, and building and evolving an array library is easier without
34+
such a coupling. Facilitation support of multiple array types in downstream
35+
libraries is an important use case however, the assumed dependency structure
36+
for that is:
37+
38+
![dependency assumptions diagram](_static/images/dependency_assumption_diagram.png)
39+
40+
Array libraries may know how to interoperate with each other, for example by
41+
constructing their own array type from that of another library or by shared
42+
memory use of an array (see [Data interchange mechanisms](design_topics/data_interchange.md)).
43+
This can be done without a dependency though - only adherence to a protocol is
44+
enough.
45+
46+
Array-consuming libraries will have to depend on one or more array libraries.
47+
That could be a "soft dependency" though, meaning retrieving an array library
48+
namespace from array instances that are passed in, but not explicitly doing
49+
`import arraylib_name`.
50+
51+
52+
## Backwards compatibility
53+
54+
The assumption made during creation of this standard is that libraries are
55+
constrained by backwards compatibility guarantees to their users, and are
56+
likely unwilling to make significant backwards-incompatible changes for the
57+
purpose of conforming to this standard. Therefore it is assumed that the
58+
standard will be made available in a new namespace within each library, or the
59+
library will provide a way to retrieve a module or module-like object that
60+
adheres to this standard. See {ref}`how-to-adopt-this-api` for more details.
61+
62+
63+
## Production code & interactive use
64+
65+
It is assumed that the primary use case is writing production code, for example
66+
in array-consuming libraries. As a consequence, making it easy to ensure that
67+
code is written as intended and has unambiguous semantics is preferred - and
68+
clear exceptions must be raised otherwise.
69+
70+
It is also assumed that this does not significantly detract from the
71+
interactive user experience. However, in case existing libraries differ in
72+
behavior, the more strict version of that behavior is typically preferred. A
73+
good example is array inputs to functions - while NumPy accepts lists, tuples,
74+
generators, and anything else that could be turned into an array, most other
75+
libraries only accept their own array types. This standard follows the latter choice.
76+
It is likely always possible to put a thin "interactive use convenience layer"
77+
on top of a more strict behavior.

spec/2022.12/benchmark_suite.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Benchmark suite
2+
3+
Adding a benchmark suite is planned in the future.

spec/2022.12/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
3+
from array_api_stubs import _draft as stubs_mod
4+
from _spec_conf import *
5+
6+
release = "DRAFT"
7+
sys.modules["array_api"] = stubs_mod

spec/2022.12/future_API_evolution.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
(future-API-evolution)=
2+
3+
# Future API standard evolution
4+
5+
## Scope extensions
6+
7+
Proposals for scope extensions in a future version of the API standard will follow
8+
the process documented at https://github.com/data-apis/governance/blob/master/process_document.md
9+
10+
In summary, proposed new APIs go through several maturity stages, and will only be
11+
accepted in a future version of this API standard once they have reached the "Final"
12+
maturity stage, which means multiple array libraries have compliant implementations
13+
and real-world experience from use of those implementations is available.
14+
15+
16+
## Backwards compatibility
17+
18+
Functions, objects, keywords and specified behavior are added to this API standard
19+
only if those are already present in multiple existing array libraries, and if there is
20+
data that those APIs are used. Therefore it is highly unlikely that future versions
21+
of this standard will make backwards-incompatible changes.
22+
23+
The aim is for future versions to be 100% backwards compatible with older versions.
24+
Any exceptions must have strong rationales and be clearly documented in the updated
25+
API specification.
26+
27+
28+
(api-versioning)=
29+
30+
## Versioning
31+
32+
This API standard uses the following versioning scheme:
33+
34+
- The version is date-based, in the form `yyyy.mm` (e.g., `2020.12`).
35+
- The version shall not include a standard way to do `alpha`/`beta`/`rc` or
36+
`.post`/`.dev` type versions.
37+
_Rationale: that's for Python packages, not for a standard._
38+
- The version must be made available at runtime via an attribute
39+
`__array_api_version__` by a compliant implementation, in `'yyyy.mm'` format
40+
as a string, in the namespace that implements the API standard.
41+
_Rationale: dunder version strings are the standard way of doing this._
42+
43+
No utilities for dealing with version comparisons need to be provided; given
44+
the format simple string comparisons with Python operators (`=-`, `<`, `>=`,
45+
etc.) will be enough.
46+
47+
```{note}
48+
49+
Rationale for the `yyyy.mm` versioning scheme choice:
50+
the API will be provided as part of a library, which already has a versioning
51+
scheme (typically PEP 440 compliant and in the form `major.minor.bugfix`),
52+
and a way to access it via `module.__version__`. The API standard version is
53+
completely independent from the package version. Given the standardization
54+
process, it resembles a C/C++ versioning scheme (e.g. `C99`, `C++14`) more
55+
than Python package versioning.
56+
```
57+
58+
The frequency of releasing a new version of an API standard will likely be at
59+
regular intervals and on the order of one year, however no assumption on
60+
frequency of new versions appearing must be made.

0 commit comments

Comments
 (0)