array-api-extra 0.10.3__tar.gz → 0.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/.all-contributorsrc +9 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/CONTRIBUTORS.md +1 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/PKG-INFO +2 -1
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/README.md +1 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/api-assorted.md +1 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/index.md +2 -2
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/meson.build +2 -1
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/pixi.toml +8 -9
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/pyproject.toml +3 -1
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/__init__.py +1 -1
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_delegation.py +22 -11
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_helpers.py +23 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/testing.py +16 -11
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/conftest.py +3 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/meson.build +1 -0
- array_api_extra-0.11.0/tests/test_deprecation.py +15 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/test_funcs.py +2 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/test_testing.py +2 -1
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/.dprint.jsonc +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/.editorconfig +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/LICENSE +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/_templates/autosummary/class.rst +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/_templates/autosummary/function.rst +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/_templates/testing-function.rst +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/api-lazy.md +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/api-testing.md +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/conf.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/contributing.md +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/docs/contributors.md +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/lefthook.yml +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/run_deps_tests/test_run_deps.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/__init__.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_at.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_backends.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_funcs.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_lazy.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_testing.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/__init__.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_compat.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_compat.pyi +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_typing.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_typing.pyi +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/py.typed +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/__init__.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/test_at.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/test_helpers.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/test_lazy.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/tests/test_version.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/typos.toml +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/vendor_tests/__init__.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/vendor_tests/_array_api_compat_vendor.py +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/vendor_tests/meson.build +0 -0
- {array_api_extra-0.10.3 → array_api_extra-0.11.0}/vendor_tests/test_vendor.py +0 -0
|
@@ -341,6 +341,15 @@
|
|
|
341
341
|
"contributions": [
|
|
342
342
|
"review"
|
|
343
343
|
]
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"login": "Cyril-36",
|
|
347
|
+
"name": "Chaitanya Pudota",
|
|
348
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/138621648?v=4",
|
|
349
|
+
"profile": "https://github.com/Cyril-36",
|
|
350
|
+
"contributions": [
|
|
351
|
+
"code"
|
|
352
|
+
]
|
|
344
353
|
}
|
|
345
354
|
]
|
|
346
355
|
}
|
|
@@ -48,6 +48,7 @@ This project exists thanks to the following contributors
|
|
|
48
48
|
<td align="center" valign="top" width="14.28%"><a href="http://steppi.github.io"><img src="https://avatars.githubusercontent.com/u/1953382?v=4?s=100" width="100px;" alt="Albert Steppi"/><br /><sub><b>Albert Steppi</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=steppi" title="Code">💻</a> <a href="#ideas-steppi" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=steppi" title="Tests">⚠️</a></td>
|
|
49
49
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prady0t"><img src="https://avatars.githubusercontent.com/u/99216956?v=4?s=100" width="100px;" alt="Pradyot Ranjan"/><br /><sub><b>Pradyot Ranjan</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Code">💻</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Documentation">📖</a> <a href="#ideas-prady0t" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Tests">⚠️</a></td>
|
|
50
50
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lundybernard"><img src="https://avatars.githubusercontent.com/u/17297695?v=4?s=100" width="100px;" alt="Lundy Bernard"/><br /><sub><b>Lundy Bernard</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/pulls?q=is%3Apr+reviewed-by%3Alundybernard" title="Reviewed Pull Requests">👀</a></td>
|
|
51
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Cyril-36"><img src="https://avatars.githubusercontent.com/u/138621648?v=4?s=100" width="100px;" alt="Chaitanya Pudota"/><br /><sub><b>Chaitanya Pudota</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=Cyril-36" title="Code">💻</a></td>
|
|
51
52
|
</tr>
|
|
52
53
|
</tbody>
|
|
53
54
|
</table>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: array-api-extra
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary: Extra array functions built on top of the array API standard.
|
|
5
5
|
Author-Email: Lucas Colley <lucas.colley8@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -130,6 +130,7 @@ This project exists thanks to the following contributors
|
|
|
130
130
|
<td align="center" valign="top" width="14.28%"><a href="http://steppi.github.io"><img src="https://avatars.githubusercontent.com/u/1953382?v=4?s=100" width="100px;" alt="Albert Steppi"/><br /><sub><b>Albert Steppi</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=steppi" title="Code">💻</a> <a href="#ideas-steppi" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=steppi" title="Tests">⚠️</a></td>
|
|
131
131
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prady0t"><img src="https://avatars.githubusercontent.com/u/99216956?v=4?s=100" width="100px;" alt="Pradyot Ranjan"/><br /><sub><b>Pradyot Ranjan</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Code">💻</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Documentation">📖</a> <a href="#ideas-prady0t" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Tests">⚠️</a></td>
|
|
132
132
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lundybernard"><img src="https://avatars.githubusercontent.com/u/17297695?v=4?s=100" width="100px;" alt="Lundy Bernard"/><br /><sub><b>Lundy Bernard</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/pulls?q=is%3Apr+reviewed-by%3Alundybernard" title="Reviewed Pull Requests">👀</a></td>
|
|
133
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Cyril-36"><img src="https://avatars.githubusercontent.com/u/138621648?v=4?s=100" width="100px;" alt="Chaitanya Pudota"/><br /><sub><b>Chaitanya Pudota</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=Cyril-36" title="Code">💻</a></td>
|
|
133
134
|
</tr>
|
|
134
135
|
</tbody>
|
|
135
136
|
</table>
|
|
@@ -105,6 +105,7 @@ This project exists thanks to the following contributors
|
|
|
105
105
|
<td align="center" valign="top" width="14.28%"><a href="http://steppi.github.io"><img src="https://avatars.githubusercontent.com/u/1953382?v=4?s=100" width="100px;" alt="Albert Steppi"/><br /><sub><b>Albert Steppi</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=steppi" title="Code">💻</a> <a href="#ideas-steppi" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=steppi" title="Tests">⚠️</a></td>
|
|
106
106
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prady0t"><img src="https://avatars.githubusercontent.com/u/99216956?v=4?s=100" width="100px;" alt="Pradyot Ranjan"/><br /><sub><b>Pradyot Ranjan</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Code">💻</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Documentation">📖</a> <a href="#ideas-prady0t" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/data-apis/array-api-extra/commits?author=prady0t" title="Tests">⚠️</a></td>
|
|
107
107
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lundybernard"><img src="https://avatars.githubusercontent.com/u/17297695?v=4?s=100" width="100px;" alt="Lundy Bernard"/><br /><sub><b>Lundy Bernard</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/pulls?q=is%3Apr+reviewed-by%3Alundybernard" title="Reviewed Pull Requests">👀</a></td>
|
|
108
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Cyril-36"><img src="https://avatars.githubusercontent.com/u/138621648?v=4?s=100" width="100px;" alt="Chaitanya Pudota"/><br /><sub><b>Chaitanya Pudota</b></sub></a><br /><a href="https://github.com/data-apis/array-api-extra/commits?author=Cyril-36" title="Code">💻</a></td>
|
|
108
109
|
</tr>
|
|
109
110
|
</tbody>
|
|
110
111
|
</table>
|
|
@@ -62,8 +62,8 @@ a specific version, or vendor the library inside your own.
|
|
|
62
62
|
|
|
63
63
|
```{note}
|
|
64
64
|
This library depends on `array-api-compat`. We aim for compatibility with
|
|
65
|
-
the latest released
|
|
66
|
-
with older or dev versions.
|
|
65
|
+
the latest released versions of the standard and array-api-compat,
|
|
66
|
+
and your mileage may vary with older or dev/draft versions.
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
(vendoring)=
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
project(
|
|
2
2
|
'array-api-extra',
|
|
3
|
-
version: '0.
|
|
3
|
+
version: '0.11.0'
|
|
4
4
|
)
|
|
5
5
|
|
|
6
6
|
py = import('python').find_installation()
|
|
@@ -11,6 +11,7 @@ sources = {
|
|
|
11
11
|
'array_api_extra': files(
|
|
12
12
|
'src/array_api_extra/__init__.py',
|
|
13
13
|
'src/array_api_extra/_delegation.py',
|
|
14
|
+
'src/array_api_extra/py.typed',
|
|
14
15
|
'src/array_api_extra/testing.py',
|
|
15
16
|
),
|
|
16
17
|
'array_api_extra/_lib': files(
|
|
@@ -12,7 +12,6 @@ version = "*"
|
|
|
12
12
|
|
|
13
13
|
[package.host-dependencies]
|
|
14
14
|
meson-python = "*"
|
|
15
|
-
uv = "*" # interfaces with meson-python instead of pip
|
|
16
15
|
|
|
17
16
|
[package.run-dependencies]
|
|
18
17
|
array-api-compat = "*"
|
|
@@ -57,17 +56,17 @@ array-api-extra.path = "."
|
|
|
57
56
|
typing-extensions = ">=4.15.0"
|
|
58
57
|
pylint = ">=4.0.5"
|
|
59
58
|
mypy = ">=1.20.2"
|
|
60
|
-
basedpyright = ">=1.39.
|
|
59
|
+
basedpyright = ">=1.39.6"
|
|
61
60
|
numpydoc = ">=1.10.0,<2"
|
|
62
61
|
# import dependencies for mypy:
|
|
63
62
|
array-api-strict = ">=2.5,<2.6"
|
|
64
63
|
numpy = ">=2.1.3"
|
|
65
|
-
hypothesis = ">=6.
|
|
64
|
+
hypothesis = ">=6.153.0"
|
|
66
65
|
dask-core = ">=2026.3.0" # No distributed, tornado, etc.
|
|
67
66
|
dprint = ">=0.50.0,<0.51"
|
|
68
67
|
lefthook = ">=2.1.8,<3"
|
|
69
|
-
ruff = ">=0.15.
|
|
70
|
-
typos = ">=1.46.
|
|
68
|
+
ruff = ">=0.15.14,<0.16"
|
|
69
|
+
typos = ">=1.46.3,<2"
|
|
71
70
|
actionlint = ">=1.7.12,<2"
|
|
72
71
|
blacken-docs = ">=1.20.0,<2"
|
|
73
72
|
pytest = ">=9.0.3,<10"
|
|
@@ -99,7 +98,7 @@ lint = { cmd = "lefthook run pre-commit --all-files --force", description = "Run
|
|
|
99
98
|
[feature.tests.dependencies]
|
|
100
99
|
pytest = ">=9.0.3"
|
|
101
100
|
pytest-cov = ">=7.1.0"
|
|
102
|
-
hypothesis = ">=6.
|
|
101
|
+
hypothesis = ">=6.153.0"
|
|
103
102
|
array-api-strict = ">=2.5,<2.6"
|
|
104
103
|
numpy = ">=1.22.0"
|
|
105
104
|
scipy = ">=1.15.2,<2"
|
|
@@ -110,7 +109,7 @@ tests-cov = { cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --du
|
|
|
110
109
|
|
|
111
110
|
clean-vendor-compat = { cmd = "rm -rf vendor_tests/array_api_compat", description = "Delete the existing vendored version of array-api-compat", default-environment = "tests" }
|
|
112
111
|
clean-vendor-extra = { cmd = "rm -rf vendor_tests/array_api_extra", description = "Delete the existing vendored version of array-api-extra", default-environment = "tests" }
|
|
113
|
-
copy-vendor-compat = { cmd = "cp -r $(python -c 'import site; print(site.getsitepackages()[0])')/array_api_compat vendor_tests/", depends-on = ["clean-vendor-compat"], description = "Vendor a clean copy of array-api-compat", default-environment = "tests" }
|
|
112
|
+
copy-vendor-compat = { cmd = "cp -r $(python -c 'import site; print(site.getsitepackages()[0])')/array_api_compat vendor_tests/ && rm -rf vendor_tests/array_api_compat/vendor_tests && rm -rf vendor_tests/array_api_compat/tests", depends-on = ["clean-vendor-compat"], description = "Vendor a clean copy of array-api-compat", default-environment = "tests" }
|
|
114
113
|
copy-vendor-extra = { cmd = "cp -r src/array_api_extra vendor_tests/", depends-on = ["clean-vendor-extra"], description = "Vendor a clean copy of array-api-extra", default-environment = "tests" }
|
|
115
114
|
tests-vendor = { cmd = "pytest -v vendor_tests", depends-on = ["copy-vendor-compat", "copy-vendor-extra"], description = "Check that array-api-extra and array-api-compat can be vendored together", default-environment = "tests" }
|
|
116
115
|
|
|
@@ -195,7 +194,7 @@ jax = ">=0.9.2"
|
|
|
195
194
|
system-requirements = { cuda = "12" }
|
|
196
195
|
|
|
197
196
|
[feature.cuda-backends.target.linux.dependencies]
|
|
198
|
-
cupy = ">=14.0
|
|
197
|
+
cupy = ">=14.1.0"
|
|
199
198
|
jaxlib = { version = ">=0.9.2", build = "cuda12*" }
|
|
200
199
|
pytorch = { version = ">=2.10.0", build = "cuda12*" }
|
|
201
200
|
|
|
@@ -205,7 +204,7 @@ pytorch = { version = ">=2.10.0", build = "cuda12*" }
|
|
|
205
204
|
# pytorch = { version = "*", build = "cuda12*" } # unavailable
|
|
206
205
|
|
|
207
206
|
[feature.cuda-backends.target.win.dependencies]
|
|
208
|
-
cupy = ">=14.0
|
|
207
|
+
cupy = ">=14.1.0"
|
|
209
208
|
# jaxlib = { version = "*", build = "cuda12*" } # unavailable
|
|
210
209
|
pytorch = { version = ">=2.10.0", build = "cuda12*" }
|
|
211
210
|
|
|
@@ -4,7 +4,7 @@ build-backend = "mesonpy"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "array-api-extra"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.11.0"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "Lucas Colley", email = "lucas.colley8@gmail.com" },
|
|
10
10
|
# { name = "Open Source Contributors" }, # https://github.com/pypi/warehouse/issues/14813
|
|
@@ -142,6 +142,8 @@ reportUnusedParameter = false
|
|
|
142
142
|
reportImportCycles = false
|
|
143
143
|
# PyRight can't trace types in lambdas
|
|
144
144
|
reportUnknownLambdaType = false
|
|
145
|
+
# conflicts with https://docs.astral.sh/ruff/rules/explicit-string-concatenation/
|
|
146
|
+
reportImplicitStringConcatenation = false
|
|
145
147
|
|
|
146
148
|
executionEnvironments = [
|
|
147
149
|
{ root = "tests", reportPrivateUsage = false, reportUnknownArgumentType = false },
|
|
@@ -15,7 +15,7 @@ from ._lib._utils._compat import (
|
|
|
15
15
|
is_torch_namespace,
|
|
16
16
|
)
|
|
17
17
|
from ._lib._utils._compat import device as get_device
|
|
18
|
-
from ._lib._utils._helpers import asarrays, eager_shape
|
|
18
|
+
from ._lib._utils._helpers import asarrays, deprecated, eager_shape
|
|
19
19
|
from ._lib._utils._typing import Array, DType
|
|
20
20
|
|
|
21
21
|
__all__ = [
|
|
@@ -83,19 +83,23 @@ def atleast_nd(x: Array, /, *, ndim: int, xp: ModuleType | None = None) -> Array
|
|
|
83
83
|
return _funcs.atleast_nd(x, ndim=ndim, xp=xp)
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
@deprecated(
|
|
87
|
+
"`xpx.broadcast_shapes` is deprecated and will be removed in v1.0.0. "
|
|
88
|
+
"`xp.broadcast_shapes` exists in the standard as of v2025.12."
|
|
89
|
+
)
|
|
86
90
|
def broadcast_shapes(
|
|
87
91
|
*shapes: tuple[float | None, ...], xp: ModuleType | None = None
|
|
88
92
|
) -> tuple[int | None, ...]:
|
|
89
93
|
"""
|
|
90
94
|
Compute the shape of the broadcasted arrays.
|
|
91
95
|
|
|
96
|
+
.. deprecated:: 0.11.0
|
|
97
|
+
:func:`broadcast_shapes` is deprecated and will be removed in v1.0.0.
|
|
98
|
+
:func:`array_api.broadcast_shapes` exists in the standard as of v2025.12.
|
|
99
|
+
|
|
92
100
|
Duplicates :func:`numpy.broadcast_shapes`, with additional support for
|
|
93
101
|
None and NaN sizes.
|
|
94
102
|
|
|
95
|
-
This is equivalent to ``xp.broadcast_arrays(arr1, arr2, ...)[0].shape``
|
|
96
|
-
without needing to worry about the backend potentially deep copying
|
|
97
|
-
the arrays.
|
|
98
|
-
|
|
99
103
|
Parameters
|
|
100
104
|
----------
|
|
101
105
|
*shapes : tuple[int | None, ...]
|
|
@@ -300,18 +304,25 @@ def create_diagonal(
|
|
|
300
304
|
return _funcs.create_diagonal(x, offset=offset, xp=xp)
|
|
301
305
|
|
|
302
306
|
|
|
307
|
+
@deprecated(
|
|
308
|
+
"`xpx.expand_dims` is deprecated and will be removed in v1.0.0. "
|
|
309
|
+
"`xp.expand_dims` with support for a tuple of ints in `axis` "
|
|
310
|
+
"exists in the standard as of v2025.12."
|
|
311
|
+
)
|
|
303
312
|
def expand_dims(
|
|
304
313
|
a: Array, /, *, axis: int | tuple[int, ...] = (0,), xp: ModuleType | None = None
|
|
305
314
|
) -> Array:
|
|
306
315
|
"""
|
|
307
316
|
Expand the shape of an array.
|
|
308
317
|
|
|
318
|
+
.. deprecated:: 0.11.0
|
|
319
|
+
:func:`expand_dims` is deprecated and will be removed in v1.0.0.
|
|
320
|
+
:func:`array_api.expand_dims` with support for a tuple of ints in `axis`
|
|
321
|
+
exists in the standard as of v2025.12.
|
|
322
|
+
|
|
309
323
|
Insert (a) new axis/axes that will appear at the position(s) specified by
|
|
310
324
|
`axis` in the expanded array shape.
|
|
311
325
|
|
|
312
|
-
This is ``xp.expand_dims`` for `axis` an int *or a tuple of ints*.
|
|
313
|
-
Roughly equivalent to ``numpy.expand_dims`` for NumPy arrays.
|
|
314
|
-
|
|
315
326
|
Parameters
|
|
316
327
|
----------
|
|
317
328
|
a : array
|
|
@@ -804,7 +815,7 @@ def searchsorted(
|
|
|
804
815
|
Find the indices into a sorted array ``x1`` such that if the elements in ``x2``
|
|
805
816
|
were inserted before the indices, the resulting array would remain sorted.
|
|
806
817
|
|
|
807
|
-
The behavior of this function is similar to that of
|
|
818
|
+
The behavior of this function is similar to that of :func:`array_api.searchsorted`,
|
|
808
819
|
but it relaxes the requirement that `x1` must be one-dimensional.
|
|
809
820
|
This function is vectorized, treating slices along the last axis
|
|
810
821
|
as elements and preceding axes as batch (or "loop") dimensions.
|
|
@@ -1220,8 +1231,8 @@ def isin(
|
|
|
1220
1231
|
"""
|
|
1221
1232
|
Determine whether each element in `a` is present in `b`.
|
|
1222
1233
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1234
|
+
This is :func:`array_api.isin`, with additional `assume_unique`
|
|
1235
|
+
and `kind` parameters.
|
|
1225
1236
|
|
|
1226
1237
|
Parameters
|
|
1227
1238
|
----------
|
{array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_helpers.py
RENAMED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import functools
|
|
5
6
|
import io
|
|
6
7
|
import math
|
|
7
8
|
import pickle
|
|
8
9
|
import types
|
|
10
|
+
import warnings
|
|
9
11
|
from collections.abc import Callable, Generator, Iterable, Iterator
|
|
10
12
|
from functools import wraps
|
|
11
13
|
from types import ModuleType
|
|
@@ -48,6 +50,7 @@ T = TypeVar("T")
|
|
|
48
50
|
__all__ = [
|
|
49
51
|
"asarrays",
|
|
50
52
|
"capabilities",
|
|
53
|
+
"deprecated",
|
|
51
54
|
"eager_shape",
|
|
52
55
|
"in1d",
|
|
53
56
|
"is_python_scalar",
|
|
@@ -58,6 +61,26 @@ __all__ = [
|
|
|
58
61
|
]
|
|
59
62
|
|
|
60
63
|
|
|
64
|
+
def deprecated(
|
|
65
|
+
msg: str, stacklevel: int = 2
|
|
66
|
+
) -> Callable[[Callable[P, T]], Callable[P, T]]: # numpydoc ignore=PR01,RT01
|
|
67
|
+
"""Deprecate a function by emitting a warning on use."""
|
|
68
|
+
|
|
69
|
+
def decorate(func: Callable[P, T]) -> Callable[P, T]: # numpydoc ignore=GL08
|
|
70
|
+
@functools.wraps(func)
|
|
71
|
+
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T: # numpydoc ignore=GL08
|
|
72
|
+
warnings.warn(
|
|
73
|
+
msg,
|
|
74
|
+
category=DeprecationWarning,
|
|
75
|
+
stacklevel=stacklevel,
|
|
76
|
+
)
|
|
77
|
+
return func(*args, **kwargs)
|
|
78
|
+
|
|
79
|
+
return wrapper
|
|
80
|
+
|
|
81
|
+
return decorate
|
|
82
|
+
|
|
83
|
+
|
|
61
84
|
def in1d(
|
|
62
85
|
x1: Array,
|
|
63
86
|
x2: Array,
|
|
@@ -598,22 +598,23 @@ def _check_ns_shape_dtype(
|
|
|
598
598
|
np = _require_numpy()
|
|
599
599
|
|
|
600
600
|
actual_xp = array_namespace(actual) # Raises on Python scalars and lists
|
|
601
|
-
desired_xp = array_namespace(desired)
|
|
602
601
|
|
|
603
602
|
if xp is not None:
|
|
604
603
|
_msg = (
|
|
605
|
-
"Namespace of
|
|
606
|
-
f"
|
|
604
|
+
"Namespace of actual array does not match the `xp` argument.\n"
|
|
605
|
+
f"Actual array's namespace: {actual_xp.__name__}\n"
|
|
607
606
|
f"Expected namespace: {xp.__name__}."
|
|
608
607
|
)
|
|
609
|
-
assert
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
608
|
+
assert actual_xp == xp, _msg
|
|
609
|
+
desired_xp = xp
|
|
610
|
+
else:
|
|
611
|
+
desired_xp = array_namespace(desired)
|
|
612
|
+
_msg = (
|
|
613
|
+
"Namespaces of actual and desired arrays do not match.\n"
|
|
614
|
+
f"Actual: {actual_xp.__name__}\n"
|
|
615
|
+
f"Desired: {desired_xp.__name__}."
|
|
616
|
+
)
|
|
617
|
+
assert actual_xp == desired_xp, _msg
|
|
617
618
|
|
|
618
619
|
if is_numpy_namespace(actual_xp) and check_scalar:
|
|
619
620
|
# only NumPy distinguishes between scalars and arrays; we do if check_scalar.
|
|
@@ -650,6 +651,7 @@ def _check_ns_shape_dtype(
|
|
|
650
651
|
msg = f"sizes do not match: {actual_size} != {desired_size}"
|
|
651
652
|
assert actual_size == desired_size, msg
|
|
652
653
|
|
|
654
|
+
desired = desired_xp.asarray(desired)
|
|
653
655
|
if check_dtype:
|
|
654
656
|
msg = f"dtypes do not match: {actual.dtype} != {desired.dtype}"
|
|
655
657
|
assert actual.dtype == desired.dtype, msg
|
|
@@ -774,6 +776,7 @@ def assert_close(
|
|
|
774
776
|
|
|
775
777
|
Array arguments to `atol` and `rtol` must be valid input to :class:`float`.
|
|
776
778
|
"""
|
|
779
|
+
__tracebackhide__ = True
|
|
777
780
|
actual, desired, xp, np = _check_ns_shape_dtype(
|
|
778
781
|
actual, desired, check_dtype, check_shape, check_scalar, xp
|
|
779
782
|
)
|
|
@@ -857,6 +860,7 @@ def assert_equal(
|
|
|
857
860
|
assert_close : Similar function for inexact equality checks.
|
|
858
861
|
numpy.testing.assert_array_equal : Similar function for NumPy arrays.
|
|
859
862
|
"""
|
|
863
|
+
__tracebackhide__ = True
|
|
860
864
|
actual, desired, xp, np = _check_ns_shape_dtype(
|
|
861
865
|
actual, desired, check_dtype, check_shape, check_scalar, xp
|
|
862
866
|
)
|
|
@@ -918,6 +922,7 @@ def assert_less(
|
|
|
918
922
|
assert_close : Similar function for inexact equality checks.
|
|
919
923
|
numpy.testing.assert_array_less : Similar function for NumPy arrays.
|
|
920
924
|
"""
|
|
925
|
+
__tracebackhide__ = True
|
|
921
926
|
x, y, xp, np = _check_ns_shape_dtype(
|
|
922
927
|
x, y, check_dtype, check_shape, check_scalar, xp
|
|
923
928
|
)
|
|
@@ -128,6 +128,9 @@ def xp(
|
|
|
128
128
|
# Possibly wrap module with array_api_compat
|
|
129
129
|
xp = array_namespace(xp.empty(0))
|
|
130
130
|
|
|
131
|
+
if library.like(Backend.ARRAY_API_STRICT):
|
|
132
|
+
xp.set_array_api_strict_flags(api_version="2025.12")
|
|
133
|
+
|
|
131
134
|
if library == Backend.ARRAY_API_STRICTEST:
|
|
132
135
|
with xp.ArrayAPIStrictFlags(
|
|
133
136
|
boolean_indexing=False,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from types import ModuleType
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from array_api_extra import broadcast_shapes, expand_dims
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestDeprecatedFunctions:
|
|
9
|
+
def test_broadcast_shapes(self, xp: ModuleType):
|
|
10
|
+
with pytest.raises(DeprecationWarning, match=r"removed in v1.0.0"):
|
|
11
|
+
_ = broadcast_shapes((2, 3), (2, 1), xp=xp)
|
|
12
|
+
|
|
13
|
+
def test_expand_dims(self, xp: ModuleType):
|
|
14
|
+
with pytest.raises(DeprecationWarning, match=r"removed in v1.0.0"):
|
|
15
|
+
_ = expand_dims(xp.ones(2), axis=0, xp=xp)
|
|
@@ -488,6 +488,7 @@ class TestAtLeastND:
|
|
|
488
488
|
assert_equal(y, xp.asarray([[[[[[[[[3.0]], [[2.0]]]]]]]]]))
|
|
489
489
|
|
|
490
490
|
|
|
491
|
+
@pytest.mark.filterwarnings("ignore:.*removed in v1.0.0.*:DeprecationWarning")
|
|
491
492
|
class TestBroadcastShapes:
|
|
492
493
|
def test_delegates_known_integer_shapes(self, monkeypatch: pytest.MonkeyPatch):
|
|
493
494
|
calls = []
|
|
@@ -828,6 +829,7 @@ class TestDefaultDType:
|
|
|
828
829
|
assert default_dtype(xp, "complex floating") == xp.complex64
|
|
829
830
|
|
|
830
831
|
|
|
832
|
+
@pytest.mark.filterwarnings(r"ignore:.*removed in v1.0.0.*:DeprecationWarning")
|
|
831
833
|
class TestExpandDims:
|
|
832
834
|
def test_single_axis(self, xp: ModuleType):
|
|
833
835
|
"""Trivial case where xpx.expand_dims doesn't add anything to xp.expand_dims"""
|
|
@@ -81,10 +81,11 @@ class TestAssertEqualCloseLess:
|
|
|
81
81
|
func(xp.asarray(0), 0)
|
|
82
82
|
with pytest.raises(TypeError, match="list is not a supported array type"):
|
|
83
83
|
func(xp.asarray([0]), [0])
|
|
84
|
+
func(xp.asarray(0), xp.asarray(1 if func is assert_less else 0), xp=xp)
|
|
84
85
|
with (
|
|
85
86
|
pytest.raises(
|
|
86
87
|
AssertionError,
|
|
87
|
-
match="Namespace of
|
|
88
|
+
match="Namespace of actual array does not match the `xp` argument",
|
|
88
89
|
),
|
|
89
90
|
):
|
|
90
91
|
func(xp.asarray(0), xp.asarray(0), xp=np)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/__init__.py
RENAMED
|
File without changes
|
{array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_compat.py
RENAMED
|
File without changes
|
{array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_compat.pyi
RENAMED
|
File without changes
|
{array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_typing.py
RENAMED
|
File without changes
|
{array_api_extra-0.10.3 → array_api_extra-0.11.0}/src/array_api_extra/_lib/_utils/_typing.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|