feat: Add DataType.from_name constructor#37
Merged
Conversation
DataType is expectedDataType.from_name constructor
kylebarron
commented
Jun 22, 2026
Comment on lines
+32
to
+55
| DataTypeName: TypeAlias = Literal[ | ||
| "bool", | ||
| "int8", | ||
| "int16", | ||
| "int32", | ||
| "int64", | ||
| "uint8", | ||
| "uint16", | ||
| "uint32", | ||
| "uint64", | ||
| "float16", | ||
| "float32", | ||
| "float64", | ||
| "complex64", | ||
| "complex128", | ||
| "string", | ||
| "bytes", | ||
| ] | ||
| """The Zarr v3 names of the built-in fixed data types. | ||
|
|
||
| Documents the common names for editor autocompletion; arbitrary strings (e.g. | ||
| raw `"r*"` types or extension data types) are still accepted by | ||
| `DataType.from_string`. | ||
| """ |
Member
Author
There was a problem hiding this comment.
This will change to using zarr-metadata in the next PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At first this PR was planned to be
which would have supported
but that's kinda messy. Perhaps that's a good API for a higher level Zarr-Python API, but I think at the Zarrista level we should always aim to be explicit.
Instead, this PR just adds
DataType.from_nameand changes the existing constructor toDataType.from_metadata