Skip to content

design/pydantic models#8

Open
d-v-b wants to merge 17 commits into
zarr-conventions:mainfrom
d-v-b:design/pydantic-models
Open

design/pydantic models#8
d-v-b wants to merge 17 commits into
zarr-conventions:mainfrom
d-v-b:design/pydantic-models

Conversation

@d-v-b

@d-v-b d-v-b commented May 8, 2026

Copy link
Copy Markdown
Collaborator

adds optional pydantic integration

d-v-b and others added 17 commits May 2, 2026 12:20
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GEO_PROJ, SPATIAL, MULTISCALES, LICENSE, UOM are exported as
Final[ConventionName] strings so users can write models[GEO_PROJ]
with autocomplete instead of remembering the hyphen in 'geo-proj'.
README gains a brief note showing the zarr-python attrs idiom
(arr.attrs.put(build_attrs(...)) / parse_attrs(dict(arr.attrs))).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces ClassVar[Any] on _MODULE with a generic
ConventionModuleProtocol[DataT], so each subclass binds to its convention's
TypedDict (GeoProjAttrs, SpatialAttrs, etc.). The base class now declares
exactly the surface it depends on (UUID, insert, extract). Removes the
cast() calls that the looser typing previously needed in _base.py and the
wrapper-key models' insert overrides; the wrapper-key insert overrides
keep a typed cast since super().to_attrs() returns dict[str, Any] but the
module's insert wants the concrete TypedDict.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The README's pydantic section already existed but the rendered docs
(docs/index.md, docs/api.md) still described the package as TypedDicts
only. Adds a parallel pydantic section to docs/index.md with a runnable
example using GEO_PROJ/LICENSE constants and a brief zarr-python interop
note. docs/api.md gains an mkdocstrings section pointing at the
zarr_cm.pydantic public surface (models + build_attrs/parse_attrs).
README's Overview list gains a forward link to the pydantic section so
skimmers know the option exists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The docs/superpowers/ directory holds local-only planning artifacts from
the Claude Code superpowers skill (specs, plans). They live under docs/
because that's the skill's default, but they aren't part of the published
documentation. Adding them to .gitignore prevents accidental commits, and
adding `exclude_docs: superpowers/` to mkdocs.yml stops mkdocs --strict
from failing on the files (which it did because their relative source
links don't resolve when the docs are rendered as a flat site).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant