array-api-strict 1.1__py3-none-any.whl → 1.1.1__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.
@@ -17,6 +17,8 @@ from __future__ import annotations
17
17
 
18
18
  import operator
19
19
  from enum import IntEnum
20
+ import warnings
21
+
20
22
  from ._creation_functions import asarray
21
23
  from ._dtypes import (
22
24
  _DType,
@@ -480,8 +482,10 @@ class Array:
480
482
  def __array_namespace__(
481
483
  self: Array, /, *, api_version: Optional[str] = None
482
484
  ) -> types.ModuleType:
483
- if api_version is not None and not api_version.startswith("2021."):
485
+ if api_version is not None and api_version not in ["2021.12", "2022.12"]:
484
486
  raise ValueError(f"Unrecognized array API version: {api_version!r}")
487
+ if api_version == "2021.12":
488
+ warnings.warn("The 2021.12 version of the array API specification was requested but the returned namespace is actually version 2022.12")
485
489
  import array_api_strict
486
490
  return array_api_strict
487
491
 
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-03-08T13:47:35-0700",
11
+ "date": "2024-03-29T16:44:48-0600",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "e6fb25db36ce4732478855520d75b4224a0cb067",
15
- "version": "1.1"
14
+ "full-revisionid": "b835dd24b8702b23e0b40dae82783dabeeb5d8e1",
15
+ "version": "1.1.1"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -23,7 +23,7 @@ from .._dtypes import (
23
23
  uint64,
24
24
  bool as bool_,
25
25
  )
26
-
26
+ import array_api_strict
27
27
 
28
28
  def test_validate_index():
29
29
  # The indexing tests in the official array API test suite test that the
@@ -398,3 +398,13 @@ def test_array_keys_use_private_array():
398
398
  key = ones((0, 0), dtype=bool_)
399
399
  with pytest.raises(IndexError):
400
400
  a[key]
401
+
402
+ def test_array_namespace():
403
+ a = ones((3, 3))
404
+ assert a.__array_namespace__() == array_api_strict
405
+ assert a.__array_namespace__(api_version=None) is array_api_strict
406
+ assert a.__array_namespace__(api_version="2022.12") is array_api_strict
407
+ with pytest.warns(UserWarning):
408
+ assert a.__array_namespace__(api_version="2021.12") is array_api_strict
409
+ pytest.raises(ValueError, lambda: a.__array_namespace__(api_version="2021.11"))
410
+ pytest.raises(ValueError, lambda: a.__array_namespace__(api_version="2023.12"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: array_api_strict
3
- Version: 1.1
3
+ Version: 1.1.1
4
4
  Summary: A strict, minimal implementation of the Python array API standard.
5
5
  Home-page: https://data-apis.org/array-api-strict/
6
6
  Author: Consortium for Python Data API Standards
@@ -34,6 +34,10 @@ libraries. Consuming library code should use the
34
34
  support the array API. Rather, it is intended to be used in the test suites of
35
35
  consuming libraries to test their array API usage.
36
36
 
37
+ array-api-strict currently supports the 2022.12 version of the standard.
38
+ 2023.12 support is planned and is tracked by [this
39
+ issue](https://github.com/data-apis/array-api-strict/issues/25).
40
+
37
41
  ## Install
38
42
 
39
43
  `array-api-strict` is available on both
@@ -1,5 +1,5 @@
1
1
  array_api_strict/__init__.py,sha256=cXEybrrXZOSyqr1JtCDKnKWCrMycZuVd_J6jdHgvnso,5061
2
- array_api_strict/_array_object.py,sha256=liFkS3y4MVkpxNlAkJsOHWFYg0BInLRaaGpY3FGlUio,44922
2
+ array_api_strict/_array_object.py,sha256=uusWUXgJQnbxrOEiNK2JiwiZaXXhLe-qm9iGWn6fH7I,45131
3
3
  array_api_strict/_constants.py,sha256=AYayN2jf1Dp5rXZ7WPBdUhtPBo_JMCi-pD9oW5zmFkI,87
4
4
  array_api_strict/_creation_functions.py,sha256=rcgdgxmRWFg1FWW8IkBqlk8PuMatlpD5rz3LLErTgh4,11640
5
5
  array_api_strict/_data_type_functions.py,sha256=LJc62mWGtRsgfDS4M3WlCdl51HojcP7jApmcwdJ55l8,6436
@@ -13,11 +13,11 @@ array_api_strict/_sorting_functions.py,sha256=7pszlxNN7-DNqEZlonGLFQrlXPP7evVA8j
13
13
  array_api_strict/_statistical_functions.py,sha256=I2k2Ql-Bdwh8VmvqfeQdZjncHiMQHGzolCbFIl65aoY,3680
14
14
  array_api_strict/_typing.py,sha256=VVqlHrb4qFCQ-wn5Xrs4BmNk_lnh5X4yBx5iafdMwho,1112
15
15
  array_api_strict/_utility_functions.py,sha256=HwycylbPAgRVz4nZvjvwqN3mQnJbqKA-NRMaAvIP-CE,824
16
- array_api_strict/_version.py,sha256=M_lEho1__YIS9E5u5ogjfmM5V2SQBb8m95MvIyAZU4Q,495
16
+ array_api_strict/_version.py,sha256=fS-cEEmAWOk_mE_jDhBRGyz9bT0V4MGj9-B2_A2jZtM,497
17
17
  array_api_strict/fft.py,sha256=YuyPom-zog_i-yLSYFw300CFdPCJc7xbU0gq1UHXlNg,8996
18
18
  array_api_strict/linalg.py,sha256=PhspNehj7Ag8RF3piB-A_FRXUTm-6Fwrr8sUe8lG1l0,18556
19
19
  array_api_strict/tests/__init__.py,sha256=t_2GZ3lKcsu4ec4GMKPUDYaeMUJyDquBlQAcPgj7kFE,282
20
- array_api_strict/tests/test_array_object.py,sha256=N_Leal0TBEPnx8gzCXGtex-kTtnJ-Q_4_Yk1bC8kHeo,17300
20
+ array_api_strict/tests/test_array_object.py,sha256=LdTakMvT42AvtAjbn1i-FmhpaHuPchWoI6woUSB3ef4,17859
21
21
  array_api_strict/tests/test_creation_functions.py,sha256=dO3b22XOy3quhUG8gFNvy_n_0OdDcTcvTSrrNLBrASU,6711
22
22
  array_api_strict/tests/test_data_type_functions.py,sha256=hZ1r3jIsZ9CE746b2doMwORPqgxXhx8dXj27CS07t7E,1292
23
23
  array_api_strict/tests/test_elementwise_functions.py,sha256=CTj4LLwtusI51HkpzD0JPohP1ffNxogAVFz8WLuWFzM,3800
@@ -26,8 +26,8 @@ array_api_strict/tests/test_manipulation_functions.py,sha256=wce25dSJjubrGhFxmia
26
26
  array_api_strict/tests/test_set_functions.py,sha256=ikzab1j3SXxGf0OqwHrOAM13HwQetdhtB60Zc_gc1DE,542
27
27
  array_api_strict/tests/test_sorting_functions.py,sha256=fJ1ahz8ihYTb9SylqNXufMRdHMwGSzK2n6LFx29KzaU,598
28
28
  array_api_strict/tests/test_validation.py,sha256=JdsK4z1M0U5YoJrfWSzOpEhmlehvZHF5SG0I0k6oDy8,672
29
- array_api_strict-1.1.dist-info/LICENSE,sha256=djDm4UfHAJmycwFUNyUmrTdRkrFF9Ac8uqIlbxH7j5Y,1585
30
- array_api_strict-1.1.dist-info/METADATA,sha256=2BI7fTWe1W_LBl75niW9H--aOmAwYX83D2Ar48zggZs,9825
31
- array_api_strict-1.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
32
- array_api_strict-1.1.dist-info/top_level.txt,sha256=M4cE8VLgRHp_d9TPkbk7_I4JriELFdEJz-NKJJqAkAE,17
33
- array_api_strict-1.1.dist-info/RECORD,,
29
+ array_api_strict-1.1.1.dist-info/LICENSE,sha256=djDm4UfHAJmycwFUNyUmrTdRkrFF9Ac8uqIlbxH7j5Y,1585
30
+ array_api_strict-1.1.1.dist-info/METADATA,sha256=sQr0eTZZdSxnqueYYD8YVhtpPg0wEsILpKWyEyWhf1Q,10017
31
+ array_api_strict-1.1.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
32
+ array_api_strict-1.1.1.dist-info/top_level.txt,sha256=M4cE8VLgRHp_d9TPkbk7_I4JriELFdEJz-NKJJqAkAE,17
33
+ array_api_strict-1.1.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5