Skip to content

✨: add CanArrayX protocols #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9185997
✨: move HasArrayNamespace to _array.py and update imports
nstarman Jun 22, 2025
10dfe43
✨: add Array class definition
nstarman Jun 22, 2025
0906408
refactor: rename type variable in HasArrayNamespace protocol for cons…
nstarman Jun 22, 2025
b2e998a
✨: add CanArrayPos protocol
nstarman Jun 22, 2025
836b386
✨: add CanArrayNeg protocol
nstarman Jun 22, 2025
9e8b867
✨: add CanArrayAdd protocol
nstarman Jun 22, 2025
f72ba68
✨: add CanArraySub Protocol
nstarman Jun 22, 2025
da34fcb
✨: add HasArrayMul protocol
nstarman Jun 22, 2025
e2e3333
✨: add CanArrayTrueDiv protocol
nstarman Jun 22, 2025
b4acd32
✨: add CanArrayFloorDiv protocol
nstarman Jun 22, 2025
0518856
✨: add CanArrayMod protocol
nstarman Jun 22, 2025
f47d4af
✨: add CanArrayPow protocol
nstarman Jun 22, 2025
6cc70ac
✨: add CanArrayIAdd protocol
nstarman Jun 23, 2025
b7e216d
✨: add CanArrayISub protocol
nstarman Jun 23, 2025
b232bd9
✨: add CanArrayIMul protocol
nstarman Jun 23, 2025
bb7773e
✨: add CanArrayITruediv protocol
nstarman Jun 23, 2025
78194dc
✨: add CanArrayIFloorDiv protocol
nstarman Jun 23, 2025
111e3b5
✨: add CanArrayIPow protocol
nstarman Jun 23, 2025
b1bfa16
✨: add CanArrayIMod protocol
nstarman Jun 23, 2025
aac59ea
✨: add CanArrayRAdd protocol
nstarman Jun 23, 2025
c6d4966
✨: add CanArrayRSub protocol
nstarman Jun 23, 2025
bbcf341
✨: add CanArrayRMul protocol
nstarman Jun 23, 2025
cca6714
✨: add CanArrayRTruediv protocol
nstarman Jun 23, 2025
94b8d8a
✨: add CanArrayRFloorDiv protocol
nstarman Jun 23, 2025
c0ec500
✨: add CanArrayRPow protocol
nstarman Jun 23, 2025
a1be18e
✨: add CanArrayRMod protocol
nstarman Jun 23, 2025
25fc475
➕ `optype`!
jorenham Jul 1, 2025
6b6cfe1
📌 pin the correct python version
jorenham Jul 1, 2025
67fabe1
🔧 `ruff` <3 `optype`
jorenham Jul 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
]
dependencies = [
"typing-extensions>=4.14.0",
"optype>=0.9.3; python_version < '3.11'",
"optype>=0.10.0; python_version >= '3.11'",
]

[project.urls]
Expand Down Expand Up @@ -133,19 +135,25 @@ version_tuple = {version_tuple!r}
"D107", # Missing docstring in __init__
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D401", # First line of docstring should be in imperative mood
"FBT", # flake8-boolean-trap
"FIX", # flake8-fixme
"ISC001", # Conflicts with formatter
"PLW1641", # Object does not implement `__hash__` method
"PYI041", # Use `float` instead of `int | float`
]

[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["ANN201", "D1", "S101"]

[tool.ruff.lint.flake8-import-conventions]
banned-from = ["array_api_typing"]
banned-from = ["array_api_typing", "optype", "optype.numpy", "optype.numpy.compat"]

[tool.ruff.lint.flake8-import-conventions.extend-aliases]
array_api_typing = "xpt"
optype = "op"
"optype.numpy" = "onp"
"optype.numpy.compat" = "npc"

[tool.ruff.lint.isort]
combine-as-imports = true
Expand Down
3 changes: 2 additions & 1 deletion src/array_api_typing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Static typing support for the array API standard."""

__all__ = (
"Array",
"HasArrayNamespace",
"__version__",
"__version_tuple__",
)

from ._namespace import HasArrayNamespace
from ._array import Array, HasArrayNamespace
from ._version import version as __version__, version_tuple as __version_tuple__
Loading