array-api-strict 2.2__py3-none-any.whl → 2.3__py3-none-any.whl

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.
Files changed (30) hide show
  1. array_api_strict/__init__.py +10 -7
  2. array_api_strict/_array_object.py +31 -19
  3. array_api_strict/_creation_functions.py +2 -0
  4. array_api_strict/_data_type_functions.py +34 -3
  5. array_api_strict/_dtypes.py +1 -0
  6. array_api_strict/_elementwise_functions.py +140 -471
  7. array_api_strict/_fft.py +31 -5
  8. array_api_strict/_flags.py +10 -8
  9. array_api_strict/_helpers.py +37 -0
  10. array_api_strict/_linear_algebra_functions.py +1 -1
  11. array_api_strict/_manipulation_functions.py +5 -0
  12. array_api_strict/_searching_functions.py +44 -5
  13. array_api_strict/_statistical_functions.py +42 -5
  14. array_api_strict/_version.py +16 -16
  15. array_api_strict/tests/test_array_object.py +146 -74
  16. array_api_strict/tests/test_creation_functions.py +7 -0
  17. array_api_strict/tests/test_data_type_functions.py +24 -4
  18. array_api_strict/tests/test_elementwise_functions.py +66 -8
  19. array_api_strict/tests/test_flags.py +29 -18
  20. array_api_strict/tests/test_manipulation_functions.py +1 -1
  21. array_api_strict/tests/test_searching_functions.py +24 -0
  22. array_api_strict/tests/test_statistical_functions.py +19 -1
  23. array_api_strict/tests/test_validation.py +1 -1
  24. array_api_strict-2.3.dist-info/METADATA +68 -0
  25. array_api_strict-2.3.dist-info/RECORD +43 -0
  26. {array_api_strict-2.2.dist-info → array_api_strict-2.3.dist-info}/WHEEL +1 -1
  27. array_api_strict-2.2.dist-info/METADATA +0 -37
  28. array_api_strict-2.2.dist-info/RECORD +0 -41
  29. {array_api_strict-2.2.dist-info → array_api_strict-2.3.dist-info}/LICENSE +0 -0
  30. {array_api_strict-2.2.dist-info → array_api_strict-2.3.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,7 @@
1
+ import cmath
1
2
  import pytest
2
3
 
3
- from .._flags import set_array_api_strict_flags
4
+ from .._flags import set_array_api_strict_flags, ArrayAPIStrictFlags
4
5
 
5
6
  import array_api_strict as xp
6
7
 
@@ -37,3 +38,20 @@ def test_sum_prod_trace_2023_12(func_name):
37
38
  assert func(a_real).dtype == xp.float32
38
39
  assert func(a_complex).dtype == xp.complex64
39
40
  assert func(a_int).dtype == xp.int64
41
+
42
+
43
+ # mean(complex-valued array) is allowed from 2024.12 onwards
44
+ def test_mean_complex():
45
+ a = xp.asarray([1j, 2j, 3j])
46
+
47
+ with ArrayAPIStrictFlags(api_version='2023.12'):
48
+ with pytest.raises(TypeError):
49
+ xp.mean(a)
50
+
51
+ m = xp.mean(a)
52
+ assert cmath.isclose(complex(m), 2j)
53
+
54
+ # mean of integer arrays is still not allowed
55
+ with pytest.raises(TypeError):
56
+ xp.mean(xp.arange(3))
57
+
@@ -18,7 +18,7 @@ def p(func: Callable, *args, **kwargs):
18
18
  [
19
19
  p(xp.can_cast, 42, xp.int8),
20
20
  p(xp.can_cast, xp.int8, 42),
21
- p(xp.result_type, 42),
21
+ p(xp.result_type, "42"),
22
22
  ],
23
23
  )
24
24
  def test_raises_on_invalid_types(func, args, kwargs):
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.2
2
+ Name: array_api_strict
3
+ Version: 2.3
4
+ Summary: A strict, minimal implementation of the Python array API standard.
5
+ Author: Consortium for Python Data API Standards
6
+ License: Copyright (c) 2021-2024, NumPy Developers, Consortium for Python Data API Standards
7
+
8
+ All rights reserved.
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are
12
+ met:
13
+
14
+ * Redistributions of source code must retain the above copyright
15
+ notice, this list of conditions and the following disclaimer.
16
+
17
+ * Redistributions in binary form must reproduce the above
18
+ copyright notice, this list of conditions and the following
19
+ disclaimer in the documentation and/or other materials provided
20
+ with the distribution.
21
+
22
+ * Neither the name of the NumPy Developers nor the names of any
23
+ contributors may be used to endorse or promote products derived
24
+ from this software without specific prior written permission.
25
+
26
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
+
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.9
40
+ Classifier: Programming Language :: Python :: 3.10
41
+ Classifier: Programming Language :: Python :: 3.11
42
+ Classifier: Programming Language :: Python :: 3.12
43
+ Classifier: Programming Language :: Python :: 3.13
44
+ Classifier: License :: OSI Approved :: BSD License
45
+ Classifier: Operating System :: OS Independent
46
+ Requires-Python: >=3.9
47
+ Description-Content-Type: text/markdown
48
+ License-File: LICENSE
49
+ Requires-Dist: numpy
50
+
51
+ # array-api-strict
52
+
53
+ `array_api_strict` is a strict, minimal implementation of the [Python array
54
+ API](https://data-apis.org/array-api/latest/).
55
+
56
+ The purpose of array-api-strict is to provide an implementation of the array
57
+ API for consuming libraries to test against so they can be completely sure
58
+ their usage of the array API is portable.
59
+
60
+ It is *not* intended to be used by end-users. End-users of the array API
61
+ should just use their favorite array library (NumPy, CuPy, PyTorch, etc.) as
62
+ usual. It is also not intended to be used as a dependency by consuming
63
+ libraries. Consuming library code should use the
64
+ [array-api-compat](https://data-apis.org/array-api-compat/) package to
65
+ support the array API. Rather, it is intended to be used in the test suites of
66
+ consuming libraries to test their array API usage.
67
+
68
+ See the documentation for more details https://data-apis.org/array-api-strict/
@@ -0,0 +1,43 @@
1
+ array_api_strict/__init__.py,sha256=GDez0wXMz0GD2RvY9QF60kiueaYYOAcUTOjUhtT2xSI,7023
2
+ array_api_strict/_array_object.py,sha256=Ig6WJNPjYvTnf1Ry4JsSt09OfkEjcG6TYXtG_TaZ6d8,53111
3
+ array_api_strict/_constants.py,sha256=AYayN2jf1Dp5rXZ7WPBdUhtPBo_JMCi-pD9oW5zmFkI,87
4
+ array_api_strict/_creation_functions.py,sha256=sjkIVxh0gbiIgpRGwjo5_R2i4Purb2MJfAljl1v6ogY,13017
5
+ array_api_strict/_data_type_functions.py,sha256=FvIlbcHo0QdOHirF4Kumkm_GJ6EVSbap9uBK2fBSDRQ,8135
6
+ array_api_strict/_dtypes.py,sha256=UxX6e2pEBeRrd_V21bdg85Wxr94d1YUq4USrT1I8Ioo,6278
7
+ array_api_strict/_elementwise_functions.py,sha256=ClJ2aDwPazGW_wvYnGjzBXL-YdgY6ejkU8s_Ev8wif4,23510
8
+ array_api_strict/_fft.py,sha256=qm9xcjKQAxjmNuq6fgkf-49E6OHhLodyHpfPIpoHmxc,10302
9
+ array_api_strict/_flags.py,sha256=m3Q117wbnOmgg4fr4cBuDw5x4VAOUn05pnPrTFAZ5vk,13647
10
+ array_api_strict/_helpers.py,sha256=bUPymEpDYkKIg26QJyv1baMZ073CFvFWXvmssl9P4_o,1328
11
+ array_api_strict/_indexing_functions.py,sha256=3AqC8Mgi9BakrStlZoIV34d0Au5dMk6qT07TxpvvCGk,1520
12
+ array_api_strict/_info.py,sha256=QvW1PV7dO2oGPWAerG3wJn61QAqjqxx4iHkWPUturI4,4455
13
+ array_api_strict/_linalg.py,sha256=sfmd5fuq2nHy_9kD2QQ23_JbbVZo7LHFgb10qjrr7nw,19846
14
+ array_api_strict/_linear_algebra_functions.py,sha256=FNvaEbiOL4HkHpTtav9OvEFsSrv-6ezaqeajRPALn1Y,3881
15
+ array_api_strict/_manipulation_functions.py,sha256=njyE4GiGsjLL-wNC8Uw4hk9H6bLaEUneyn2DAYB6TDM,6878
16
+ array_api_strict/_searching_functions.py,sha256=bpQ34TswrMQAGf9PCxOSCvMRblz8pESZM8ykZX4oavU,4425
17
+ array_api_strict/_set_functions.py,sha256=PZVsxkRQi5Zi104dI2fHZBFqpluOAW0IJzzdJSyajiI,3295
18
+ array_api_strict/_sorting_functions.py,sha256=GG7g2NYCFn2G2fFS6ZdfYOWpuuSIrdZdJWEuL72_-LI,2065
19
+ array_api_strict/_statistical_functions.py,sha256=I_nNZyv4aKRmrJjdsw0PJZCtQ-TgKuMyaBMWbSioTlI,6237
20
+ array_api_strict/_typing.py,sha256=oaHM01VhgC5JIHxXMouEEajNs0OXtwOasnIznK7z9fk,1889
21
+ array_api_strict/_utility_functions.py,sha256=Mu07FogReaAFToPMHE_j90YBEDEvxD5jPcMK3zeUiG0,2007
22
+ array_api_strict/_version.py,sha256=pZpW6lpOhTpAuLHtqGwrQRgYRKMXHKOJQqzsSQQg4yg,506
23
+ array_api_strict/tests/__init__.py,sha256=t_2GZ3lKcsu4ec4GMKPUDYaeMUJyDquBlQAcPgj7kFE,282
24
+ array_api_strict/tests/conftest.py,sha256=-wIDryl2MdRLdSonU1G1xWssNq2TFKiWuHquNasXYA8,468
25
+ array_api_strict/tests/test_array_object.py,sha256=N84q_642ypibxihmRssWth4eHPs8AbpQrktCbZDipIc,23567
26
+ array_api_strict/tests/test_creation_functions.py,sha256=qPflQZN4Bc1aGwTPqodSNcEdvXjvOeNp59cvxUGq0lg,8515
27
+ array_api_strict/tests/test_data_type_functions.py,sha256=1zQ4qkA6x9GWB-OQuAr9ndpUcocfNY95W8Zt4iC4Kgs,2860
28
+ array_api_strict/tests/test_device_support.py,sha256=zpfhHxeRREoXfp0qZTlilm2ZceBc71uCKea1GMVe-ZU,855
29
+ array_api_strict/tests/test_elementwise_functions.py,sha256=K2bUKe-YZOR-T0G-Kz2xtgNr06xKi_ks0uk8v_rJziQ,9293
30
+ array_api_strict/tests/test_flags.py,sha256=kcBbFB4aq3XY_9HM1j3wKmq8MVNfU4YxwK21mARM0iw,18982
31
+ array_api_strict/tests/test_indexing_functions.py,sha256=C23FnuowVDC1OBuDH06pvsd61qM2dTpTwzw6UgC4BoY,1281
32
+ array_api_strict/tests/test_linalg.py,sha256=CJ4JnCkWyysMUAih3PI-ZZeOH-X39H0p-RKBoEwk6Jw,5675
33
+ array_api_strict/tests/test_manipulation_functions.py,sha256=Yc92IvA3FaTZueqAUOFMkx3MH4PXCHDof7ckrJxudQs,1078
34
+ array_api_strict/tests/test_searching_functions.py,sha256=I3upSNe9B1YbMLG1E2BgkHpwoq9GGLRvT9U4MW5ZBIo,746
35
+ array_api_strict/tests/test_set_functions.py,sha256=ikzab1j3SXxGf0OqwHrOAM13HwQetdhtB60Zc_gc1DE,542
36
+ array_api_strict/tests/test_sorting_functions.py,sha256=1xvQBKts5KTKYc-puMITX9iR_KTbzzVB8fY-SObad_Y,899
37
+ array_api_strict/tests/test_statistical_functions.py,sha256=0ihnw4W9vOqU6RMBOUw29Fg-xumXpfz0h05v0E0RsMQ,1814
38
+ array_api_strict/tests/test_validation.py,sha256=Dtl-kGRtdslaPVWWtr3rBrIsJPuj7LZz6_pw2yjwkWE,674
39
+ array_api_strict-2.3.dist-info/LICENSE,sha256=djDm4UfHAJmycwFUNyUmrTdRkrFF9Ac8uqIlbxH7j5Y,1585
40
+ array_api_strict-2.3.dist-info/METADATA,sha256=nAEaW70ZVU_lQcgQ44RZiF047N7gnqdNiTzMBjcp174,3423
41
+ array_api_strict-2.3.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
42
+ array_api_strict-2.3.dist-info/top_level.txt,sha256=M4cE8VLgRHp_d9TPkbk7_I4JriELFdEJz-NKJJqAkAE,17
43
+ array_api_strict-2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.4.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,37 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: array_api_strict
3
- Version: 2.2
4
- Summary: A strict, minimal implementation of the Python array API standard.
5
- Home-page: https://data-apis.org/array-api-strict/
6
- Author: Consortium for Python Data API Standards
7
- License: MIT
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Classifier: License :: OSI Approved :: BSD License
14
- Classifier: Operating System :: OS Independent
15
- Requires-Python: >=3.9
16
- Description-Content-Type: text/markdown
17
- License-File: LICENSE
18
- Requires-Dist: numpy
19
-
20
- # array-api-strict
21
-
22
- `array_api_strict` is a strict, minimal implementation of the [Python array
23
- API](https://data-apis.org/array-api/latest/).
24
-
25
- The purpose of array-api-strict is to provide an implementation of the array
26
- API for consuming libraries to test against so they can be completely sure
27
- their usage of the array API is portable.
28
-
29
- It is *not* intended to be used by end-users. End-users of the array API
30
- should just use their favorite array library (NumPy, CuPy, PyTorch, etc.) as
31
- usual. It is also not intended to be used as a dependency by consuming
32
- libraries. Consuming library code should use the
33
- [array-api-compat](https://data-apis.org/array-api-compat/) package to
34
- support the array API. Rather, it is intended to be used in the test suites of
35
- consuming libraries to test their array API usage.
36
-
37
- See the documentation for more details https://data-apis.org/array-api-strict/
@@ -1,41 +0,0 @@
1
- array_api_strict/__init__.py,sha256=Nm_8GFfA0bpkVMw3urULYSadngGPaW6C2VuEpM-ziyI,6904
2
- array_api_strict/_array_object.py,sha256=Q69HJ8qdQqqugWIRf4RsifZUEypbhNV_y5EVSygmbrQ,52571
3
- array_api_strict/_constants.py,sha256=AYayN2jf1Dp5rXZ7WPBdUhtPBo_JMCi-pD9oW5zmFkI,87
4
- array_api_strict/_creation_functions.py,sha256=A9TTvPSznF9NsxT0Pd_G9yU6IZAfW1tpBkFMYoJyguw,12985
5
- array_api_strict/_data_type_functions.py,sha256=sKxKRQiwoXPwQJPbiN5BhF9rbc3ZtXfjRuglB7VsIgo,7016
6
- array_api_strict/_dtypes.py,sha256=QDGo9rqiS_o3quv7QRFM0j6DkvOjRauQ1Ymikwlu8Ns,6213
7
- array_api_strict/_elementwise_functions.py,sha256=epo92ppRP4XDcDhS431J599NA1pT4DK08wIdV9vVO8s,39713
8
- array_api_strict/_fft.py,sha256=xH1o4j_amq3e1yGVChV6vms7oAfCzpzB18I-IzjNSXw,9702
9
- array_api_strict/_flags.py,sha256=lUb-SowhHvA9MLBm0ICO5L7M7FgclWPF8v8z5N--Q_o,13558
10
- array_api_strict/_indexing_functions.py,sha256=3AqC8Mgi9BakrStlZoIV34d0Au5dMk6qT07TxpvvCGk,1520
11
- array_api_strict/_info.py,sha256=QvW1PV7dO2oGPWAerG3wJn61QAqjqxx4iHkWPUturI4,4455
12
- array_api_strict/_linalg.py,sha256=sfmd5fuq2nHy_9kD2QQ23_JbbVZo7LHFgb10qjrr7nw,19846
13
- array_api_strict/_linear_algebra_functions.py,sha256=12XPBU27X3WZdaq9Ob2eUmL_PxMzDNF76pY4iESlPyo,3872
14
- array_api_strict/_manipulation_functions.py,sha256=Pa1gVRlaSC39-Zd6n4Q8c9P0anZYdyCh95Wyx3az3lc,6681
15
- array_api_strict/_searching_functions.py,sha256=32IiLLpa91N-jtzaxj4Nw9nQgF2ROkcNZ-XH6WQQUHY,3233
16
- array_api_strict/_set_functions.py,sha256=PZVsxkRQi5Zi104dI2fHZBFqpluOAW0IJzzdJSyajiI,3295
17
- array_api_strict/_sorting_functions.py,sha256=GG7g2NYCFn2G2fFS6ZdfYOWpuuSIrdZdJWEuL72_-LI,2065
18
- array_api_strict/_statistical_functions.py,sha256=dMJ-x8TQW5MD2rFYCmRH6QthA2KDKXjhkj4hcbd3LSU,5148
19
- array_api_strict/_typing.py,sha256=oaHM01VhgC5JIHxXMouEEajNs0OXtwOasnIznK7z9fk,1889
20
- array_api_strict/_utility_functions.py,sha256=Mu07FogReaAFToPMHE_j90YBEDEvxD5jPcMK3zeUiG0,2007
21
- array_api_strict/_version.py,sha256=20M94v12DlLnRLp4vkFO-TkQKxHY21bls4ZgOvbf7jE,495
22
- array_api_strict/tests/__init__.py,sha256=t_2GZ3lKcsu4ec4GMKPUDYaeMUJyDquBlQAcPgj7kFE,282
23
- array_api_strict/tests/conftest.py,sha256=-wIDryl2MdRLdSonU1G1xWssNq2TFKiWuHquNasXYA8,468
24
- array_api_strict/tests/test_array_object.py,sha256=IzfVo63eiPoFFwb4woNT15e4gJFfYVyD7zK-wddRMBY,21865
25
- array_api_strict/tests/test_creation_functions.py,sha256=ve0MeqZPrG2dmCG3hTVhap1YgIW-lAaSZIJ_ZoOV9cQ,8323
26
- array_api_strict/tests/test_data_type_functions.py,sha256=pLAtm96gpAduNVqq-914JvjAollzhBp4YojVfNScBzs,2138
27
- array_api_strict/tests/test_device_support.py,sha256=zpfhHxeRREoXfp0qZTlilm2ZceBc71uCKea1GMVe-ZU,855
28
- array_api_strict/tests/test_elementwise_functions.py,sha256=ManUmYZF3oT-UXH4lqWJna3zDHdxVBeuvIdFlFPABQ4,7114
29
- array_api_strict/tests/test_flags.py,sha256=YadbyJEu7DmMo3TKl3nROf7R4xDIrQfm8acifHA3CYc,18598
30
- array_api_strict/tests/test_indexing_functions.py,sha256=C23FnuowVDC1OBuDH06pvsd61qM2dTpTwzw6UgC4BoY,1281
31
- array_api_strict/tests/test_linalg.py,sha256=CJ4JnCkWyysMUAih3PI-ZZeOH-X39H0p-RKBoEwk6Jw,5675
32
- array_api_strict/tests/test_manipulation_functions.py,sha256=CzcudVxUKhQ4Ec94Vda4C6HaAqrOQPQfQxT4uTM2fsM,1064
33
- array_api_strict/tests/test_set_functions.py,sha256=ikzab1j3SXxGf0OqwHrOAM13HwQetdhtB60Zc_gc1DE,542
34
- array_api_strict/tests/test_sorting_functions.py,sha256=1xvQBKts5KTKYc-puMITX9iR_KTbzzVB8fY-SObad_Y,899
35
- array_api_strict/tests/test_statistical_functions.py,sha256=JwS4DhASt5T0YUNtbFK2nSXgDrVVZx1tVpe7LU2aPK4,1365
36
- array_api_strict/tests/test_validation.py,sha256=JdsK4z1M0U5YoJrfWSzOpEhmlehvZHF5SG0I0k6oDy8,672
37
- array_api_strict-2.2.dist-info/LICENSE,sha256=djDm4UfHAJmycwFUNyUmrTdRkrFF9Ac8uqIlbxH7j5Y,1585
38
- array_api_strict-2.2.dist-info/METADATA,sha256=uCWtV4ZiiCzUkNRWapj10LpJxUCPHy8fzddfOiFt2cM,1593
39
- array_api_strict-2.2.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
40
- array_api_strict-2.2.dist-info/top_level.txt,sha256=M4cE8VLgRHp_d9TPkbk7_I4JriELFdEJz-NKJJqAkAE,17
41
- array_api_strict-2.2.dist-info/RECORD,,