-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deprecate array_api for jax v0.4.32+ (#79)
Signed-off-by: nstarman <[email protected]>
- Loading branch information
Showing
10 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Doctest configuration.""" | ||
|
||
import platform | ||
from doctest import ELLIPSIS, NORMALIZE_WHITESPACE | ||
|
||
from sybil import Sybil | ||
from sybil.parsers.rest import DocTestParser, PythonCodeBlockParser, SkipParser | ||
|
||
# TODO: stop skipping doctests on Windows when there is uniform support for | ||
# numpy 2.0+ scalar repr. On windows it is printed as 1.0 instead of | ||
# `np.float64(1.0)`. | ||
parsers = ( | ||
[DocTestParser(optionflags=ELLIPSIS | NORMALIZE_WHITESPACE)] | ||
if platform.system() != "Windows" | ||
else [] | ||
) + [ | ||
PythonCodeBlockParser(), | ||
SkipParser(), | ||
] | ||
|
||
pytest_collect_file = Sybil( | ||
parsers=parsers, | ||
patterns=["*.rst", "*.py"], | ||
).pytest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Setup file for the Quaxed package.""" | ||
|
||
from importlib.metadata import version | ||
|
||
JAX_VERSION: tuple[int, ...] = tuple(map(int, version("jax").split("."))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
"""Quaxed :mod:`jax.numpy`.""" | ||
|
||
# pylint: disable=redefined-builtin | ||
|
||
from typing import Any | ||
|
||
from jaxtyping import install_import_hook | ||
|
||
with install_import_hook("quaxed.numpy", None): | ||
from . import _core, _creation_functions, _dispatch, _higher_order | ||
from ._core import * # TODO: make this lazy | ||
from ._creation_functions import * | ||
from ._dispatch import * | ||
from ._higher_order import * | ||
from . import _core, _creation_functions, _dispatch, _higher_order | ||
from ._creation_functions import * | ||
from ._dispatch import * | ||
from ._higher_order import * | ||
|
||
__all__: list[str] = [] | ||
__all__ += _core.__all__ | ||
__all__ += _higher_order.__all__ | ||
__all__ += _creation_functions.__all__ | ||
__all__ += _dispatch.__all__ | ||
|
||
|
||
# TODO: consolidate with ``_core.__getattr__``. | ||
def __getattr__(name: str) -> Any: | ||
if name in __all__: | ||
return getattr(_core, name) | ||
|
||
msg = f"module {__name__!r} has no attribute {name!r}" | ||
raise AttributeError(msg) | ||
|
||
|
||
# TODO: figure out how to install this import hook, with the __getattr__. | ||
install_import_hook("quaxed.numpy", None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters