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

[v3] Typing: use TypedDict for all dictionaries #1773

Open
jhamman opened this issue Apr 5, 2024 · 1 comment · May be fixed by #2099
Open

[v3] Typing: use TypedDict for all dictionaries #1773

jhamman opened this issue Apr 5, 2024 · 1 comment · May be fixed by #2099
Assignees
Labels
V3 Related to compatibility with V3 spec
Milestone

Comments

@jhamman
Copy link
Member

jhamman commented Apr 5, 2024

Small typing improvement here. @d-v-b - can you expand on what needs to be done (feel free to edit this description)?

edit from @d-v-b :

the v3 branch has models of zarr v3 metadata that do runtime validation of user input; e.g., array metadata is modeled with this class. Because the metadata models inherit from the base Metadata class, they can serialize to dictionaries. Right now, these output dictionaries are not typed, but we do know their types exactly.

So we should define TypedDict classes for every metadata model that has a well-defined dict representation (all of them, I think). I would also explore making the base Metadata class generic, with a type parameter bounded by dict[str, JSON], and using that type parameter for the return type of to_dict, and the input of from_dict.

These TypedDict instances will make the developer experience better, because we will know exactly what shape our dict-serialized metadata objects have.

@jhamman jhamman added the V3 Related to compatibility with V3 spec label Apr 5, 2024
@jhamman jhamman added this to the 3.0.0 milestone Apr 5, 2024
@ahmadjiha
Copy link

Hello @jhamman @d-v-b! I am excited for zarr v3 and would be interested in working on this issue.

@ahmadjiha ahmadjiha linked a pull request Aug 19, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V3 Related to compatibility with V3 spec
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants