File tree Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -55,23 +55,21 @@ array-api-strict = "*"
55
55
# clean array-api-tests dir
56
56
clean-xp-tests = { cwd = " ." , cmd = " rm -rf array-api-tests" }
57
57
# clone array-api-tests
58
- clone-xp-tests.cmd = " git clone https://github.com/lucascolley/array-api-tests.git"
59
- clone-xp-tests.cwd = " ."
60
- clone-xp-tests.depends-on = [" clean-xp-tests" ]
61
- # checkout array-api-tests commit
62
- checkout-xp-tests.cmd = [
58
+ clone-xp-tests.cmd = [
63
59
" git" ,
64
- " reset" ,
65
- " --hard" ,
66
- " 4244965fe1cdf1394143f089beac587307f375fa" ,
60
+ " clone" ,
61
+ " https://github.com/data-apis/array-api-tests.git" ,
62
+ " &&" ,
63
+ " cd" ,
64
+ " array-api-tests" ,
67
65
" &&" ,
68
66
" git" ,
69
67
" submodule" ,
70
68
" update" ,
71
69
" --init" ,
72
70
]
73
- checkout -xp-tests.cwd = " array-api-tests "
74
- checkout -xp-tests.depends-on = [" clone -xp-tests" ]
71
+ clone -xp-tests.cwd = " . "
72
+ clone -xp-tests.depends-on = [" clean -xp-tests" ]
75
73
# run tests
76
74
xp-tests.cmd = [
77
75
" pytest" ,
@@ -92,9 +90,9 @@ xp-tests.cmd = [
92
90
" --disable-deadline" ,
93
91
" array_api_tests/" ,
94
92
]
95
- xp-tests.env.ARRAY_API_TESTS_MODULE = " exec('import pint_array, array_api_strict; xp = pint_array.pint_namespace( array_api_strict)') "
93
+ xp-tests.env.ARRAY_API_TESTS_MODULE = " pint_array. array_api_strict"
96
94
xp-tests.cwd = " array-api-tests"
97
- xp-tests.depends-on = [" checkout -xp-tests" ]
95
+ xp-tests.depends-on = [" clone -xp-tests" ]
98
96
99
97
[tool .pixi .feature .py310 .dependencies ]
100
98
python = " ~=3.10.0"
Original file line number Diff line number Diff line change 7
7
8
8
from __future__ import annotations
9
9
10
+ import importlib
11
+ import sys
10
12
import textwrap
11
13
import types
12
14
from typing import Generic
18
20
__all__ = ["__version__" , "pint_namespace" ]
19
21
20
22
23
+ def __getattr__ (name ):
24
+ try :
25
+ xp = importlib .import_module (name )
26
+ mod = pint_namespace (xp )
27
+ sys .modules [f"marray.{ name } " ] = mod
28
+ return mod
29
+ except ModuleNotFoundError as e :
30
+ raise AttributeError (str (e )) from None
31
+
32
+
21
33
def pint_namespace (xp ):
22
34
mod = types .ModuleType (f"pint({ xp .__name__ } )" )
23
35
You can’t perform that action at this time.
0 commit comments