Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Array API in NamedArray #8344

Draft
wants to merge 467 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
467 commits
Select commit Hold shift + click to select a range
15a21c9
Update _manipulation_functions.py
Illviljan Aug 25, 2024
af70db9
Update _manipulation_functions.py
Illviljan Aug 25, 2024
d3f4c14
Update _manipulation_functions.py
Illviljan Aug 25, 2024
ac20d2c
add linalg
Illviljan Aug 25, 2024
b799a9f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
c78031a
Add set functions
Illviljan Aug 25, 2024
b797472
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
d6911a2
Update _creation_functions.py
Illviljan Aug 25, 2024
91bb8fb
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Aug 25, 2024
d9d23bb
Update __init__.py
Illviljan Aug 25, 2024
69f3061
Update _sorting_functions.py
Illviljan Aug 25, 2024
95c5bc4
Add fft
Illviljan Aug 25, 2024
4e7dffb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
09e1478
Update __init__.py
Illviljan Aug 25, 2024
9aca0cc
Update __init__.py
Illviljan Aug 25, 2024
a3f47a9
Update core.py
Illviljan Aug 25, 2024
3cebb62
Update _creation_functions.py
Illviljan Aug 25, 2024
042940b
Update _sorting_functions.py
Illviljan Aug 25, 2024
26fb6cb
Update core.py
Illviljan Aug 25, 2024
8e0af56
Update _utils.py
Illviljan Aug 25, 2024
3341e93
Revert "Update _utils.py"
Illviljan Aug 25, 2024
dc862c5
Update namedarray_array_api_skips.txt
Illviljan Aug 25, 2024
499bee9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
2d5e81c
Update _linalg.py
Illviljan Aug 25, 2024
3cee797
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Aug 25, 2024
45abdfd
Update _indexing_functions.py
Illviljan Aug 25, 2024
d3efb66
Update _utils.py
Illviljan Aug 25, 2024
7b8592a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
02b4f41
Update core.py
Illviljan Aug 25, 2024
0470089
Update _utils.py
Illviljan Aug 25, 2024
5ff5f66
Update _sorting_functions.py
Illviljan Aug 25, 2024
3e1123b
fix linalg
Illviljan Aug 25, 2024
7215680
Use stable repr
Illviljan Aug 25, 2024
3c6e8c5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
9d0b142
Update __init__.py
Illviljan Aug 25, 2024
d277ab1
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Aug 25, 2024
0b2f21b
stricter
Illviljan Aug 25, 2024
d54210c
stricter
Illviljan Aug 25, 2024
5622bd7
Update _elementwise_functions.py
Illviljan Aug 25, 2024
ee71d04
Update core.py
Illviljan Aug 25, 2024
ec55434
Update core.py
Illviljan Aug 25, 2024
93bd9ca
more
Illviljan Aug 25, 2024
ec0e79c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
1da91ea
Update _elementwise_functions.py
Illviljan Aug 25, 2024
bc4e69c
more
Illviljan Aug 25, 2024
dc37d5c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
b1d7a59
Update _statistical_functions.py
Illviljan Aug 25, 2024
48e5e9e
more
Illviljan Aug 25, 2024
813396a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2024
94eb7b2
Update core.py
Illviljan Aug 25, 2024
4a50a8a
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Aug 25, 2024
ce8a60a
Update core.py
Illviljan Aug 25, 2024
bef1ead
Update core.py
Illviljan Aug 25, 2024
c13a8ae
Update _elementwise_functions.py
Illviljan Aug 25, 2024
e56e7cb
Update core.py
Illviljan Aug 26, 2024
acc4dc0
Simplify asarray
Illviljan Aug 27, 2024
2466035
promote scalars correctly
Illviljan Aug 27, 2024
a06972b
Merge branch 'main' into add_array_api_mean
Illviljan Aug 27, 2024
1dad0e3
fix
Illviljan Aug 27, 2024
a7b3a1c
all shapes less or equal than 1 are broadcastable
Illviljan Aug 28, 2024
8ad9d1f
Update _elementwise_functions.py
Illviljan Aug 28, 2024
a6091eb
Update _elementwise_functions.py
Illviljan Aug 28, 2024
9221751
simplify like functions
Illviljan Sep 1, 2024
60aa969
Update _utils.py
Illviljan Sep 1, 2024
451ac17
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 1, 2024
dc070d7
Update _creation_functions.py
Illviljan Sep 1, 2024
29fb043
Update _creation_functions.py
Illviljan Sep 1, 2024
9e36876
Update _utils.py
Illviljan Sep 1, 2024
9b681c9
add typing
Illviljan Sep 1, 2024
e9649ef
remove atleast_0d
Illviljan Sep 1, 2024
ac1265e
use set instead, if len>1 something is odd is happening
Illviljan Sep 1, 2024
407c8d6
Update _utils.py
Illviljan Sep 2, 2024
aab7b22
Update _elementwise_functions.py
Illviljan Sep 2, 2024
d82a7cc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 2, 2024
f73e7a1
typing
Illviljan Sep 2, 2024
43c81e3
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 2, 2024
bd083b2
Merge branch 'main' into add_array_api_mean
Illviljan Sep 2, 2024
b026b3c
Update _info.py
Illviljan Sep 2, 2024
8d3f192
methods
Illviljan Sep 2, 2024
221ba48
Update _manipulation_functions.py
Illviljan Sep 2, 2024
157c46d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 2, 2024
26182d2
Update _fft.py
Illviljan Sep 2, 2024
212dcdd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 2, 2024
d31fe95
Update _linalg.py
Illviljan Sep 2, 2024
d05791c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 2, 2024
5fccd5f
Update _typing.py
Illviljan Sep 2, 2024
39fa648
Update _utils.py
Illviljan Sep 2, 2024
7b80343
Merge branch 'main' into add_array_api_mean
Illviljan Sep 3, 2024
d37c44d
Make default unhashable
Illviljan Sep 3, 2024
beb3016
typing
Illviljan Sep 3, 2024
e993f3b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 3, 2024
b86ee93
Update _typing.py
Illviljan Sep 3, 2024
99426cb
Update _statistical_functions.py
Illviljan Sep 3, 2024
18d5001
Create a truly non hashable default by subclassing list
Illviljan Sep 6, 2024
4272a20
Update _utility_functions.py
Illviljan Sep 6, 2024
a6cf097
typing
Illviljan Sep 8, 2024
4fa029b
Merge branch 'main' into add_array_api_mean
Illviljan Sep 8, 2024
b1ad54c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2024
9657bf2
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 8, 2024
63db063
Update _typing.py
Illviljan Sep 8, 2024
e810921
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2024
d9b516d
Update _creation_functions.py
Illviljan Sep 8, 2024
686ef2b
Update _data_type_functions.py
Illviljan Sep 8, 2024
937724d
Update _linear_algebra_functions.py
Illviljan Sep 8, 2024
28dde6a
Update _set_functions.py
Illviljan Sep 8, 2024
9354771
Update _typing.py
Illviljan Sep 8, 2024
ee12ae5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2024
4de05f8
Using operators instead should handle inplace methods missing
Illviljan Sep 8, 2024
0328e44
Update _indexing_functions.py
Illviljan Sep 8, 2024
7f9c8bb
Update core.py
Illviljan Sep 8, 2024
6014235
Update _utils.py
Illviljan Sep 8, 2024
117548d
Update _utils.py
Illviljan Sep 8, 2024
64278e5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2024
783be0d
Update _utils.py
Illviljan Sep 8, 2024
652097b
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 8, 2024
5ce92c9
Update core.py
Illviljan Sep 8, 2024
1ba871a
Merge branch 'main' into add_array_api_mean
Illviljan Sep 8, 2024
de99d36
skip cumulative sum
Illviljan Sep 8, 2024
1835514
Update _typing.py
Illviljan Sep 8, 2024
68c271c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2024
92ee203
Update _typing.py
Illviljan Sep 8, 2024
e70fee7
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 8, 2024
019a610
Update core.py
Illviljan Sep 8, 2024
6e7de32
Update core.py
Illviljan Sep 9, 2024
c302e65
Update core.py
Illviljan Sep 9, 2024
ad6d7e4
Update _utils.py
Illviljan Sep 10, 2024
8fa6d58
Update _manipulation_functions.py
Illviljan Sep 10, 2024
b65de7a
Update _manipulation_functions.py
Illviljan Sep 11, 2024
0d0ea3b
normalize negative values to positive
Illviljan Sep 11, 2024
52343d9
more tests and fixes to broadcasted dims
Illviljan Sep 17, 2024
5e3da64
Add dims for basic array creation
Illviljan Sep 17, 2024
f45429d
add examples
Illviljan Sep 19, 2024
7efcef2
add dim keywords
Illviljan Sep 19, 2024
04b01b3
Update _manipulation_functions.py
Illviljan Sep 19, 2024
4a97364
Add arithmetic broadcasting
Illviljan Sep 19, 2024
f4f3268
Use arithmetic broadcasting
Illviljan Sep 19, 2024
656ab62
Add doctests
Illviljan Sep 19, 2024
95f8490
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 19, 2024
b9e6457
Merge branch 'main' into add_array_api_mean
Illviljan Sep 19, 2024
9d4b9d2
Update _utils.py
Illviljan Sep 19, 2024
f64f967
reflexive should broadcast as well
Illviljan Sep 19, 2024
5540702
typing
Illviljan Sep 19, 2024
b269650
Handle unordered dims
Illviljan Sep 20, 2024
218eba1
Update _manipulation_functions.py
Illviljan Sep 20, 2024
8ee6172
subclasses needs to be passed down
Illviljan Sep 20, 2024
90e4819
prioritize variable arithmetics
Illviljan Sep 20, 2024
c295100
Update indexing.py
Illviljan Sep 21, 2024
d02f4f2
add copy to __array__
Illviljan Sep 21, 2024
825805b
calculate dims from tuple indexing
Illviljan Sep 21, 2024
e29287d
Handle getitem better
Illviljan Sep 21, 2024
28df307
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2024
eb73c2d
Update _utils.py
Illviljan Sep 21, 2024
a450e8a
Update core.py
Illviljan Sep 21, 2024
30a4fea
Merge branch 'main' into add_array_api_mean
Illviljan Sep 21, 2024
9c3f6c1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2024
73a7d2f
improve dims handling
Illviljan Sep 21, 2024
e947757
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 21, 2024
45c6db0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2024
e90508e
typo
Illviljan Sep 21, 2024
93933d6
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 21, 2024
de0aa20
Update _utils.py
Illviljan Sep 21, 2024
17346f7
Update indexing.py
Illviljan Sep 21, 2024
1173cc0
Update indexing.py
Illviljan Sep 21, 2024
8a5a041
Update _manipulation_functions.py
Illviljan Sep 21, 2024
fae50aa
add examples
Illviljan Sep 21, 2024
52f7edf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2024
805a0c5
Update _manipulation_functions.py
Illviljan Sep 22, 2024
4621e26
Clarify the paths
Illviljan Sep 24, 2024
f6e90d0
Shorten name
Illviljan Sep 24, 2024
31ef484
Add atleast1d for dims, unique_values seems to need it
Illviljan Sep 24, 2024
c049f98
unique_values is atleast1d
Illviljan Sep 24, 2024
749235b
Update _manipulation_functions.py
Illviljan Sep 24, 2024
c77feb1
Update core.py
Illviljan Sep 24, 2024
fe17279
Merge branch 'main' into add_array_api_mean
Illviljan Sep 24, 2024
00115d1
Update _set_functions.py
Illviljan Sep 24, 2024
6cf9fae
Update _set_functions.py
Illviljan Sep 24, 2024
18400d5
indexing are always 1d?
Illviljan Sep 24, 2024
842b289
0D concatenation
Illviljan Sep 24, 2024
733a45a
lets try reshape again
Illviljan Sep 24, 2024
b7ceeb4
Update _utils.py
Illviljan Sep 24, 2024
43f757e
Ellipsis are often converted to slices
Illviljan Sep 25, 2024
e8b2b4e
Convert ellipsis to slices
Illviljan Sep 25, 2024
ec3880e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2024
4431175
Update _manipulation_functions.py
Illviljan Sep 25, 2024
a86d900
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 25, 2024
1267750
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2024
5bafb8c
Try simplify mean
Illviljan Sep 25, 2024
7c278dc
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 25, 2024
c59fb54
Seems successfull do it on the rest
Illviljan Sep 25, 2024
889feaa
more places to simplify
Illviljan Sep 25, 2024
f6ffdaf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2024
793d166
squeeze
Illviljan Sep 25, 2024
4ef9e1c
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Sep 25, 2024
353d8bf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2024
0f26d51
Update _utils.py
Illviljan Sep 25, 2024
2cec2c7
typing
Illviljan Sep 25, 2024
c5a3054
Update _utils.py
Illviljan Sep 25, 2024
e3923f4
matrix_transpose
Illviljan Sep 26, 2024
b8c4ba5
Merge branch 'main' into add_array_api_mean
Illviljan Sep 26, 2024
31d8882
Update _linear_algebra_functions.py
Illviljan Sep 26, 2024
0c83ff6
simplify function names
Illviljan Sep 26, 2024
27ebb03
vecdot
Illviljan Sep 26, 2024
0022d04
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2024
b7d734a
Use normal repr
Illviljan Sep 27, 2024
1891a6c
Normal repr
Illviljan Sep 27, 2024
e77d38d
Merge branch 'main' into add_array_api_mean
Illviljan Sep 27, 2024
26de5e4
Update _statistical_functions.py
Illviljan Sep 27, 2024
5496da9
Update _linear_algebra_functions.py
Illviljan Sep 27, 2024
6499fb7
Update _set_functions.py
Illviljan Sep 27, 2024
4dba4bf
flip
Illviljan Sep 30, 2024
930c485
moveaxis
Illviljan Oct 5, 2024
2a83e70
repeat
Illviljan Oct 5, 2024
ef2843c
Update _manipulation_functions.py
Illviljan Oct 5, 2024
649118a
Update _manipulation_functions.py
Illviljan Oct 5, 2024
d7adbd8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 5, 2024
e88af20
roll
Illviljan Oct 5, 2024
557f654
Update _utils.py
Illviljan Oct 12, 2024
8c1c970
Update _utils.py
Illviljan Oct 12, 2024
19e1923
arange
Illviljan Oct 12, 2024
1844721
asarray
Illviljan Oct 12, 2024
22ed956
asarray
Illviljan Oct 12, 2024
02c1aa7
empty
Illviljan Oct 12, 2024
5f293b0
empty_like
Illviljan Oct 12, 2024
2e89630
eye
Illviljan Oct 12, 2024
e94ed05
Update _creation_functions.py
Illviljan Oct 12, 2024
468c90d
from_dlpack
Illviljan Oct 12, 2024
38b0c4b
full
Illviljan Oct 12, 2024
4163297
Update _creation_functions.py
Illviljan Oct 12, 2024
bbac8eb
full_like
Illviljan Oct 12, 2024
bab4856
linspace
Illviljan Oct 14, 2024
f01159c
Merge branch 'main' into add_array_api_mean
Illviljan Oct 14, 2024
20498ff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 14, 2024
3a0941c
meshgrid
Illviljan Oct 17, 2024
11e02c4
ones
Illviljan Oct 17, 2024
14108e2
ones_like
Illviljan Oct 17, 2024
ce633a8
tril
Illviljan Oct 17, 2024
8307e3e
triu
Illviljan Oct 17, 2024
69bd690
zeros
Illviljan Oct 17, 2024
b24d3b5
zeros_like
Illviljan Oct 17, 2024
d8a955f
Merge branch 'main' into add_array_api_mean
Illviljan Oct 17, 2024
0856ccb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 17, 2024
7ae8e68
Update core.py
Illviljan Oct 21, 2024
e8131ce
Update _utils.py
Illviljan Oct 21, 2024
437b3e0
all
Illviljan Oct 21, 2024
38cff61
any
Illviljan Oct 21, 2024
f7e870c
diff
Illviljan Oct 21, 2024
7d9918c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2024
befb4fe
Merge branch 'main' into add_array_api_mean
Illviljan Nov 17, 2024
05c2b78
handle 0 dim arrays in meshgrid
Illviljan Nov 17, 2024
1fdcea4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/array-api-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: NamedArray._array_api

on: [push, pull_request]

env:
PYTEST_ARGS: "-v -rxXfE --ci --hypothesis-disable-deadline --max-examples 5"
API_VERSIONS: "2023.12"

jobs:
array-api-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
exclude:
- python-version: '3.8'

steps:
- name: Checkout xarray
uses: actions/checkout@v4
with:
path: xarray
- name: Checkout array-api-tests
uses: actions/checkout@v4
with:
repository: data-apis/array-api-tests
submodules: 'true'
path: array-api-tests
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ${GITHUB_WORKSPACE}/xarray
python -m pip install -r ${GITHUB_WORKSPACE}/array-api-tests/requirements.txt
python -m pip install hypothesis
python -m pip install array-api-strict
python -m pip install array-api-compat
- name: Run the array API testsuite
env:
ARRAY_API_TESTS_MODULE: xarray.namedarray._array_api
run: |
cd ${GITHUB_WORKSPACE}/array-api-tests
pytest array_api_tests/ --skips-file ${GITHUB_WORKSPACE}/xarray/xarray/tests/namedarray_array_api_skips.txt ${PYTEST_ARGS}
2 changes: 1 addition & 1 deletion xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _as_array_or_item(data):
return data


class Variable(NamedArray, AbstractArray, VariableArithmetic):
class Variable(AbstractArray, VariableArithmetic, NamedArray):
"""A netcdf-like variable consisting of dimensions, data and attributes
which describe a single Array. A single Variable object is not fully
described outside the context of its parent Dataset (if you want such a
Expand Down
221 changes: 0 additions & 221 deletions xarray/namedarray/_array_api.py

This file was deleted.

Loading
Loading