Skip to content

Conversation

dstansby
Copy link
Collaborator

@dstansby dstansby commented Sep 9, 2025

I found myself wanting to specify codecs in v3 array specs, and not wanting to write the JSON by hand, so I ended up down this rabbit hole and implemented pydantic classes for all the codecs in the spec. I'm not sure if this is welcome or duplicates work elsewhere, so I will not be offended if this is not merged :)

@d-v-b
Copy link
Collaborator

d-v-b commented Sep 9, 2025

this looks good to me! I don't think this restricts us any any way, so 👍

@dstansby
Copy link
Collaborator Author

dstansby commented Oct 2, 2025

@d-v-b I'm returning to this, and don't want to conflict with what's alread in pydantic-zarr for v3 configuration. In the current v3 code you used a TypedDict for NamdedConfig, and not a pydantic BaseModel, which I what I tried to use here with the codecs. Do you remember why you used TypedDicts instead of pydantic models for the config?

@d-v-b
Copy link
Collaborator

d-v-b commented Oct 2, 2025

@d-v-b I'm returning to this, and don't want to conflict with what's alread in pydantic-zarr for v3 configuration. In the current v3 code you used a TypedDict for NamdedConfig, and not a pydantic BaseModel, which I what I tried to use here with the codecs. Do you remember why you used TypedDicts instead of pydantic models for the config?

I don't remember exactly! It's possible I was thinking about using typeddicts exported from zarr-python, and also I think typeddicts are more ergonomic for very simple metadata than pydantic models (because you don't need to import a new class to use them).

@d-v-b
Copy link
Collaborator

d-v-b commented Oct 2, 2025

We can drop the typeddict annotation if that makes things easier for you! The basemodel representation is definitely useful for validation.

@dstansby
Copy link
Collaborator Author

dstansby commented Oct 2, 2025

Okay! Let me have a bit of a think and remember what I was trying to achieve here (easier construction of codec configuration), and I'll loop back with what I think is the right thing to do 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants