Skip to content
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 chunkedduckarray to _typing #8376

Merged
merged 2 commits into from
Oct 26, 2023
Merged

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented Oct 25, 2023

Add more chunkedarray typing options.
Also clean up some ideas that didn't work out. Using TypeVar for arrays for example has turned out to not work that great because of the very common dtype changes.

If you want to check if an ArrayLike is a chunked array:

if isinstance(data, _chunkedarrayfunction_or_api):
    data.chunk()

However try to rely on mypy in private functions over isinstance checks for better performance:

def _do_compute(data: chunkedduckarray[Any, _DType]) -> duckarray[Any, _DType]:
     return data.compute()

@github-actions github-actions bot added the topic-NamedArray Lightweight version of Variable label Oct 25, 2023
Copy link
Member

@andersy005 andersy005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect 🚀! merging this shortly so i can use it in #8319

@andersy005 andersy005 merged commit 043b3dc into pydata:main Oct 26, 2023
28 of 29 checks passed
@Illviljan Illviljan deleted the add_chunkedduckarray branch October 26, 2023 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-NamedArray Lightweight version of Variable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants