-
-
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
Add T_DuckArray type hint to Variable.data #8203
Conversation
This is really annoying. Sorry for marking this @Illviljan, somehow the GitHub App does thing's without intention. |
for more information, see https://pre-commit.ci
Yay, green mypy! Some solutions are taken from #8075. |
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.
Nice work!
I can add into #8198 when this merges
Merging quickly to unblock anderson |
The typing of Variable.data has been the very wide
Variable.data: Any
because of the difficulties defining the typing of a duckarray.This has led to confusion in downstream functions that uses
.data
. Sometimes arguments uses Any, np.typing.ArrayLike, np.ndarray or dask array typing which is unnecessarily narrow when xarray also supports for example sparse arrays or cupy arrays.This PR is a start at cleaning this up by defining a T_DuckArray typevar that symbolizes an array api compliant array.