-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
feat(zep-6): Implement ZOM dataclasses for V2 and V3 objects #1526
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1526 +/- ##
===========================================
- Coverage 100.00% 99.84% -0.16%
===========================================
Files 37 39 +2
Lines 14735 15009 +274
===========================================
+ Hits 14735 14985 +250
- Misses 0 24 +24
|
this is exciting! what do you think of defining class methods on these for serializing to / from storage? Over in pydantic zarr I used the names |
Well, I've already started working on this! Currently named these |
What is the future of Maybe I am biased, but I prefer Pydantic over Python native data classes, mainly due to validation. I noticed @jhamman you wrote some of the validation manually in post_init. Pydantic also allows JSON Schema, which can be turned into documentation automatically. I can help with migrating your work to Pydantic if everyone agrees on that. @d-v-b's work would also is a good starting point. I vote we move to Pydantic 2; which is significantly faster and streamlines some of the validation boilerplate. |
@tasansal there was an offline discussion about bringing pydantic in as a zarr dependency vs implementing the ZOM with dataclasses (or similar functionality). I argued against depending on pydantic, mostly because I don't think we need pydantic to achieve the basic functionality here -- for simply defining some classes and serializing them as JSON, dataclasses are fine, and with dataclasses we don't have to worry about keeping up with pydantic development. With that in mind, I'm going to continue working on pydantic-zarr. The big to-dos are moving to pydantic v2, and zarr v3. |
Reasonable. The reason I asked all this is we are refactoring our open-source energy data format MDIO to have version-controlled dataset schemas for the v1 spec and want to be proactive and make it play nice with ZOMs and The ZOM here vs. Pydantic Zarr is confusing to users, though. Pydantic is quite a small dependency if to be added to Zarr for ZOMs in the future maybe. Cheers! |
Sorry about that. I started Ultimately, I want |
closing this as I'm not likely to return to it in its current state. Ideas here are likely to reappear in |
This (experimental) PR adds a set of Zarr Object Models in the form of datalcasses. These models are intended to be independent representations of the core Zarr classes (e.g. Array), allowing for creation of metadata-only hierarchies (groups and arrays). These models are intended to be used internally to represent the metadata of groups and arrays.
See also: zarr-developers/zeps#46
TODO:
cc @d-v-b