Skip to content

Add support for Array API in NamedArray #8344

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

Draft
wants to merge 563 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
563 commits
Select commit Hold shift + click to select a range
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
ceb2b87
Merge branch 'main' into add_array_api_mean
Illviljan Nov 26, 2024
ad46646
Merge branch 'main' into add_array_api_mean
Illviljan Dec 10, 2024
04648ca
Merge branch 'main' into add_array_api_mean
Illviljan Jan 25, 2025
9c98af8
Update _typing.py
Illviljan Feb 6, 2025
3f22432
Merge branch 'main' into add_array_api_mean
Illviljan Feb 6, 2025
010b2a1
add Anys
Illviljan Feb 6, 2025
2257829
docstring _isnone
Illviljan Feb 6, 2025
6f2d765
Update _utils.py
Illviljan Feb 6, 2025
9e8bcca
matmul docs and fixes
Illviljan Feb 6, 2025
53cda6f
Merge branch 'main' into add_array_api_mean
Illviljan Feb 16, 2025
a064865
Merge branch 'main' into add_array_api_mean
Illviljan Apr 17, 2025
da45147
Merge branch 'main' into add_array_api_mean
Illviljan Apr 18, 2025
66f6f81
Move to 2024.12 spec
Illviljan Apr 18, 2025
9101592
Handle RUF022
Illviljan Apr 18, 2025
75191bc
Handle F401, A thin wrapper for a future rework
Illviljan Apr 18, 2025
76472a8
Update __init__.py
Illviljan Apr 18, 2025
bef24bd
Update _linalg.py
Illviljan Apr 18, 2025
0765a45
2024.12 - Add dtype kwarg
Illviljan Apr 18, 2025
d80dcfa
Add count_nonzero
Illviljan Apr 18, 2025
dfe57f0
Add docstring
Illviljan Apr 18, 2025
c23b89a
Update __init__.py
Illviljan Apr 18, 2025
640fca6
Update array-api-tests.yml
Illviljan Apr 18, 2025
1c6b34e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 18, 2025
ba044f7
_datas not good enough grammar...
Illviljan Apr 18, 2025
675306a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 18, 2025
3d192de
_datas not good enough grammar...
Illviljan Apr 18, 2025
1d7d5de
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Apr 18, 2025
83f38d5
_datas not good enough grammar...
Illviljan Apr 18, 2025
8f46274
Newer python version
Illviljan Apr 18, 2025
5f02c5a
Add cumulative_prod
Illviljan Apr 18, 2025
c389c00
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 18, 2025
951e7bc
less examples to speed up ci
Illviljan Apr 18, 2025
4b1ccf5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 18, 2025
6b2f9ec
Add nextafter
Illviljan Apr 18, 2025
28e3d11
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 18, 2025
e132465
Add diff
Illviljan Apr 18, 2025
8234cb5
Update __init__.py
Illviljan Apr 18, 2025
a3eba94
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Apr 18, 2025
5270e5d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 18, 2025
d360c13
Update _utility_functions.py
Illviljan Apr 18, 2025
c7ffa51
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Apr 18, 2025
fb45da6
Add reciprocal
Illviljan Apr 18, 2025
1361e1f
Add take_along_axis
Illviljan Apr 18, 2025
2412c94
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 18, 2025
ec75d7f
Add max rank
Illviljan Apr 18, 2025
7b016b1
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Apr 18, 2025
e0f6a2a
fix nextafter
Illviljan Apr 18, 2025
2825ed4
numpy (r)fftfreq does not support dtype yet
Illviljan Apr 19, 2025
f901017
np does not support arrays for iinfo finfo
Illviljan Apr 19, 2025
9af7d0c
Merge branch 'main' into add_array_api_mean
Illviljan Apr 19, 2025
a78cb25
alphabetical order
Illviljan Apr 20, 2025
cc65e76
Handle scalars in result_type
Illviljan Apr 20, 2025
0c70f44
Add _promote_scalar
Illviljan Apr 20, 2025
4557c98
Add _promote_scalars
Illviljan Apr 20, 2025
c9659b3
Add scalars to elementwise functions
Illviljan Apr 20, 2025
2c1b7d5
Merge branch 'main' into add_array_api_mean
Illviljan Apr 20, 2025
16bb6dd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 20, 2025
bfd6609
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 20, 2025
7012c4b
types are not the same, start with all available and reduce
Illviljan Apr 20, 2025
8058c12
Update _data_type_functions.py
Illviljan Apr 20, 2025
fc0d5eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 20, 2025
2ebf9f3
Update _data_type_functions.py
Illviljan Apr 20, 2025
b8ce982
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Apr 20, 2025
07c7021
Update _elementwise_functions.py
Illviljan Apr 20, 2025
a733610
the functions handles scalars now
Illviljan Apr 20, 2025
8a6f7ea
Fix __radd__ issues
Illviljan Apr 21, 2025
f8231a9
Handle iadd
Illviljan Apr 21, 2025
8a3b97c
Update core.py
Illviljan Apr 21, 2025
dcbb9d3
Revert "Update core.py"
Illviljan Apr 21, 2025
040ed9f
Update core.py
Illviljan Apr 21, 2025
e61602e
Handle setitem
Illviljan Apr 21, 2025
633eb5c
skip test_finfo[complex64]
Illviljan Apr 21, 2025
2fafddb
Update _typing.py
Illviljan Apr 21, 2025
aac836e
Handle setitem
Illviljan Apr 21, 2025
8de9934
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 21, 2025
1a73270
Verboser loggs, very annoying not seeing the inputs for the tests.
Illviljan Apr 23, 2025
c0bac13
Merge branch 'add_array_api_mean' of https://github.com/Illviljan/xar…
Illviljan Apr 23, 2025
26a683d
Merge branch 'main' into add_array_api_mean
Illviljan Apr 23, 2025
ed5ecc7
sum: add dtype
Illviljan Apr 23, 2025
6f138ab
Update _utils_inputs.py
Illviljan Apr 23, 2025
0aeab44
Update core.py
Illviljan Apr 23, 2025
529462c
Add support for indexing arrays in tuple indexing
Illviljan Apr 23, 2025
91fbeca
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 23, 2025
a7cdab5
Merge branch 'main' into add_array_api_mean
Illviljan Apr 29, 2025
0229573
Merge branch 'main' into add_array_api_mean
Illviljan May 4, 2025
aef66ab
Merge branch 'main' into add_array_api_mean
Illviljan May 9, 2025
b8106f2
Try to handle integer arrays in indexing
Illviljan May 14, 2025
2e8aba5
Merge branch 'main' into add_array_api_mean
Illviljan May 14, 2025
c8bc9ea
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 14, 2025
80923ba
correct axis_default kwarg
Illviljan May 15, 2025
3e30dc8
Update _indexing_functions.py
Illviljan May 15, 2025
8be7897
where: condition is always an array
Illviljan May 15, 2025
c266434
Update _searching_functions.py
Illviljan May 15, 2025
344a56e
Merge branch 'main' into add_array_api_mean
Illviljan May 18, 2025
a45340f
default_device is a function
Illviljan May 21, 2025
a54c12b
Add max dimensions
Illviljan May 21, 2025
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 --hypothesis-verbosity=verbose --max-examples 2"
API_VERSIONS: "2024.12"

jobs:
array-api-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
exclude:
- python-version: "3.10"

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 @@ -311,7 +311,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