Skip to content

refactor!: allow subsets of dtypes and allow device-dependent dtype support#1005

Merged
kgryte merged 3 commits into
data-apis:mainfrom
ev-br:device_dtypes
Jul 8, 2026
Merged

refactor!: allow subsets of dtypes and allow device-dependent dtype support#1005
kgryte merged 3 commits into
data-apis:mainfrom
ev-br:device_dtypes

Conversation

@ev-br

@ev-br ev-br commented May 1, 2026

Copy link
Copy Markdown
Member

Per discussion in gh-998 and the community meeting on Apr 30th,

  • soften the requirement that all dtypes are implemented from must to should;
  • require that at least one integer dtype and one floating-point dtype is actually supported (this allows us to not bother with edge cases of e.g. no floats at all);
  • recommend that unsupported combinations of dtype=..., device=... raise an exception + specify that creation functions should raise. Note that this still leaves astype and to_device only implicitly specified and only covered by the recommendation to raise.
  • specify that cross-device transfers in __getitem__ and __setitem__ are implementation-defined (and presumably covered by the recommendation to raise).

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @ev-br! One comment on a complex dtype not needing to be required, other than that this LGTM.

I considered whether to require specific types that are currently universally available (e.g., float32, int32), but that doesn't really help in any way while it does potentially create another issue if support shifts over time. So "one integer and one float dtype" seems just fine. In practice, libraries are going to just use them anyway and they will exist; actual code will rely on how to get things working with real-world libraries, not probing the must/should distinctions in the spec (that's mostly relevant for the test suite and authors of new array libraries).

Comment thread spec/draft/API_specification/data_types.rst Outdated
Comment thread spec/draft/API_specification/data_types.rst Outdated
Comment thread spec/draft/API_specification/data_types.rst Outdated
Co-authored-by: Evgeni Burovski <evgeny.burovskiy@gmail.com>

@ogrisel ogrisel left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM.

@kgryte kgryte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@kgryte kgryte changed the title feat: allow subsets of dtypes, allow device-dependent dtype support refactor!: allow subsets of dtypes, allow device-dependent dtype support Jul 8, 2026
@kgryte kgryte added the API change Changes to existing functions or objects in the API. label Jul 8, 2026
@kgryte

kgryte commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Looks like we have consensus. I will go ahead and merge and we can still tinker with guidance in the lead up to cutting the v2026 revision later this year.

@kgryte kgryte changed the title refactor!: allow subsets of dtypes, allow device-dependent dtype support refactor!: allow subsets of dtypes and allow device-dependent dtype support Jul 8, 2026
@kgryte kgryte merged commit c009c02 into data-apis:main Jul 8, 2026
3 checks passed
@rgommers rgommers added this to the v2026 milestone Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API change Changes to existing functions or objects in the API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants