fix(zarr-metadata)!: make entity types assignable to metadata fields; validators return tuples - #317
Open
d-v-b wants to merge 2 commits into
Open
fix(zarr-metadata)!: make entity types assignable to metadata fields; validators return tuples#317d-v-b wants to merge 2 commits into
d-v-b wants to merge 2 commits into
Conversation
… validators return tuples `ZarrV3NamedConfigJSON.name` and `.configuration` are `ReadOnly` and the envelope is `closed`, so the concrete codec / chunk-grid / chunk-key-encoding / data-type TypedDicts are assignable to the fields they describe. Every concrete `*Object` / `*Configuration` is `closed` and object forms declare `must_understand: NotRequired[bool]`. Every `validate_*` in `zarr_metadata.model` returns `tuple[ValidationProblem, ...]`, `MetadataValidationError.problems` is a tuple, and `load_store_json` returns `object` rather than `Any`. `ANN401` is enforced package-wide. `ZarrV2ConsolidatedMetadataJSON.zarr_consolidated_format` is `Literal[1]`. Split from #296 (part 1 of 3). Assisted-by: ClaudeCode:claude-fable-5-1
Assisted-by: ClaudeCode:claude-fable-5-1
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.
🤖 AI text below 🤖
Part 1 of 3, split from #296. Small and independent; the other two parts stack on it.
ZarrV3NamedConfigJSON.name/.configurationareReadOnly(PEP 705) and the envelope isclosed(PEP 728), so every concrete codec / chunk-grid / chunk-key-encoding / data-type TypedDict is now assignable to the fields it describes (codecs,chunk_grid,data_type, ...). Previously a type checker rejected puttingBloscCodecMetadataintocodecs.*Object/*ConfigurationTypedDict isclosed, and object forms declaremust_understand: NotRequired[bool].validate_*inzarr_metadata.modelreturnstuple[ValidationProblem, ...]instead of a list, andMetadataValidationError.problemsis a tuple.load_store_jsonreturnsobjectrather thanAny;ANN401is enforced package-wide.ZarrV2ConsolidatedMetadataJSON.zarr_consolidated_formatisLiteral[1].zarr_metadata.pydanticserializers declare their return schema via the pydantic-facing shadow types.The structural validator is otherwise unchanged; the
dimension_names/chunksrank checks stay where they are until part 2.Verified: ruff, pyright 1.1.404 strict (0 errors), 595 tests.
🤖 Generated with Claude Code