-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Test array api protocol #7902
base: main
Are you sure you want to change the base?
Test array api protocol #7902
Conversation
for more information, see https://pre-commit.ci
…into data_array_type
for more information, see https://pre-commit.ci
Oh cool! Do you think it would be difficult for me to extend this protocol to make one for chunked array types, to test typing of functionality in #7019? |
I think you should be able to subclass Array and add the missing properties. But I haven't played around with this much at all yet. |
# NOTE: when working with py3.11+ this can be ``typing.array``. | ||
|
||
|
||
class Array(Protocol): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that numpy.array_api
exists, can we replace this entire class with that instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's possible since the types becomes too specific.
For example .mT
would always return numpy.array_api._array_object.Array
which wouldn't work with cubed.
np.array_api also implements a few methods that aren't required by the spec either making it too specific for us.
This code was vendored from a PR in the array-api github so we could hopefully import from there whenever it has been merged.
whats-new.rst
api.rst