Skip to content

Commit 61c83fe

Browse files
authored
Merge pull request #254 from NeilGirdhar/annotations
Annotate array_namespace and add py.typed
2 parents 66106cb + 1114aa5 commit 61c83fe

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

array_api_compat/common/_helpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
if TYPE_CHECKING:
1313
from typing import Optional, Union, Any
14-
from ._typing import Array, Device
14+
from ._typing import Array, Device, Namespace
1515

1616
import sys
1717
import math
@@ -439,7 +439,7 @@ def _check_api_version(api_version: str) -> None:
439439
raise ValueError("Only the 2023.12 version of the array API specification is currently supported")
440440

441441

442-
def array_namespace(*xs, api_version=None, use_compat=None):
442+
def array_namespace(*xs, api_version=None, use_compat=None) -> Namespace:
443443
"""
444444
Get the array API compatible namespace for the arrays `xs`.
445445

array_api_compat/common/_typing.py

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"SupportsBufferProtocol",
66
]
77

8+
from types import ModuleType
89
from typing import (
910
Any,
1011
TypeVar,
@@ -22,3 +23,4 @@ def __len__(self, /) -> int: ...
2223
Array = Any
2324
Device = Any
2425
DType = Any
26+
Namespace = ModuleType

array_api_compat/py.typed

Whitespace-only changes.

setup.py

+3
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@
3434
"License :: OSI Approved :: MIT License",
3535
"Operating System :: OS Independent",
3636
],
37+
package_data={
38+
"array_api_compat": ["py.typed"],
39+
},
3740
)

0 commit comments

Comments
 (0)