Skip to content

Commit 5bde2c6

Browse files
committed
DOC: add home-page docs
1 parent 2b85108 commit 5bde2c6

File tree

1 file changed

+108
-2
lines changed

1 file changed

+108
-2
lines changed

docs/index.md

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,112 @@
66
api-reference.md
77
```
88

9-
```{include} ../README.md
10-
:start-after: <!-- SPHINX-START -->
9+
This is a library housing "array-agnostic" implementations of functions built on
10+
top of [the Python array API standard](https://data-apis.org/array-api/).
11+
12+
The intended users of this library are "array-consuming" libraries which are
13+
using [array-api-compat](https://data-apis.org/array-api-compat/) to make their
14+
own library's functions array-agnostic. In this library, they will find a set of
15+
tools which provide _extra_ functionality on top of the array API standard,
16+
which other array-consuming libraries in a similar position have found useful
17+
themselves.
18+
19+
(installation)=
20+
21+
## Installation
22+
23+
`array-api-extra` is available
24+
[on PyPI](https://pypi.org/project/array-api-extra/):
25+
26+
```shell
27+
python -m pip install array-api-extra
28+
```
29+
30+
(vendoring)=
31+
32+
## Vendoring
33+
34+
```{warning}
35+
This library currently provides no backwards-compatibility guarantees!
36+
If you require stability, it is recommended to vendor this library inside your own.
37+
```
38+
39+
To vendor the library, clone
40+
[the repository](https://github.com/data-apis/array-api-extra) and copy
41+
`array_api_extra` into the appropriate place in your library, like:
42+
43+
```
44+
cp -R array_api_extra/ mylib/vendored/array_api_extra
45+
```
46+
47+
(usage)=
48+
49+
## Usage
50+
51+
Typical usage of this library looks like:
52+
53+
```python
54+
import array_api_strict as xpx
55+
56+
...
57+
xp = array_namespace(x)
58+
y = xp.sum(x)
59+
...
60+
return xpx.atleast_nd(y, ndim=2, xp=xp)
1161
```
62+
63+
```{note}
64+
Functions in this library assume input arrays *are arrays* (not "array-likes") and that
65+
the namespace passed as `xp` is compatible with the standard. This means that
66+
the namespace you pass as `xp` should come from array-api-compat's ``array_namespace``,
67+
or otherwise be compatible with the standard.
68+
```
69+
70+
In the examples shown in the docstrings of functions from this library,
71+
[`array-api-strict`](https://data-apis.org/array-api-strict/) is used as the
72+
array namespace `xp`. In reality, code using this library will be written to
73+
work with any compatible array namespace as `xp`, not any particular
74+
implementation.
75+
76+
(scope)=
77+
78+
## Scope
79+
80+
Functions that are in-scope for this library will:
81+
82+
- Implement functionality which does not already exist in the array API
83+
standard.
84+
- Implement functionality which may be generally useful across various
85+
libraries.
86+
- Be implemented purely in terms of the array API standard.
87+
- Be implemented with type annotations and
88+
[numpydoc-style docstrings](https://numpydoc.readthedocs.io/en/latest/format.html)
89+
- Be tested against `array-api-strict`.
90+
91+
In particular, the following kinds of function are also in-scope:
92+
93+
- Functions which implement
94+
[array API standard extension](https://data-apis.org/array-api/2023.12/extensions/index.html)
95+
functions in terms of functions from the base standard.
96+
- Functions which add functionality (e.g. extra parameters) to functions from
97+
the standard.
98+
99+
The following features are currently out-of-scope for this library:
100+
101+
- Delegation to known, existing array libraries.
102+
- It is quite simple to wrap functions in this library to also use existing
103+
implementations where possible. Such delegation will not live in this
104+
library for now, but the array-agnostic functions in this library could form
105+
an array-agnostic backend for such delegating functions in the future, here
106+
or elsewhere.
107+
- Functions which accept "array-like" input, or standard-incompatible
108+
namespaces.
109+
- It is possible to prepare input arrays and a standard-compatible namespace
110+
via `array-api-compat` downstream in consumer libraries. Avoiding use of
111+
`array-api-compat` in this library makes it easier to vendor and reduces
112+
potential redundant calls to `xp.asarray` and `array_namespace`.
113+
- For proposed alternatives to the `xp=xp` interface, see
114+
[this issue](https://github.com/data-apis/array-api-extra/issues/6).
115+
- Functions which are specific to a particular domain.
116+
- These functions may belong better in an array-consuming library which is
117+
specific to that domain.

0 commit comments

Comments
 (0)