Repository navigation
feat(zarr-metadata): export base64_fill_value_rules for data type definitions - #4609
Merged
d-v-b merged 3 commits intoNov 9, 2026
Merged
Conversation
…initions Export the rule that rejects a fill value string that is not standard-alphabet base64, so a data type defined outside the package can pass it as `fill_value_rules` or yield from it. `bytes` and `variable_length_bytes` now share it. The parsing and validation guide shows a data type that defines `fill_value_rules`, built with `union`. Rebased onto main as one commit; the earlier history carried the merged ZARR_PYTHON_CONTEXT branch. Assisted-by: ClaudeCode:claude-opus-5-5
…s#4609 Assisted-by: ClaudeCode:claude-opus-5-5
Documentation build overview
4 files changed± models/index.html± parsing-validation/index.html± api/model/index.html± api/v3/data_type/index.html |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4609 +/- ##
=======================================
Coverage 94.90% 94.90%
=======================================
Files 96 96
Lines 14048 14048
=======================================
Hits 13332 13332
Misses 716 716 🚀 New features to boost your workflow:
|
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.
zarr-metadataexports a rule that rejects a string that's not standard-alphabet base64, which allows externally-defined data types to use this rule to constrain admissible values for thefill_valuefield. This is demonstrated in a new section in the guide to parsing and validation.🤖 AI text below 🤖
Agent summary
Export
base64_fill_value_rulesfromzarr_metadata.v3.data_type.bytes, the rule that rejects a fill value string that is not standard-alphabet base64, so a data type defined outside the package can pass it asfill_value_rulesfor aBase64Bytesfill value, or yield from it in a rule of its own. The guide to parsing and validation now shows how to define a data type withfill_value_rules.Refs d-v-b#425. The issue asks for a way to constrain a fill value beyond its JSON type.
fill_value_rulesalready does that, and both the reader and the pydantic field apply it. The consumer's definition only setfill_value=str, the guides never mentionedfill_value_rules, and the package's base64 rule was private. This PR fixes the last two.base64_fill_value_rules(inv3/data_type/_byte.py) fits thefill_value_rulesslot and checks only strings, so it also servesbytes, whose fill value may be written as byte values.bytesandvariable_length_bytesnow use it in place of their own copies.null_terminated_bytesandzarr_python_raw_bytesstill callbase64_problemsdirectly before their size checks.docs/parsing-validation.mdgains an example: anacme.packeddata type whose rule yields frombase64_fill_value_rulesand then checks the size its configuration sets. It adds the type withCORE_AND_EXTENSIONS_CONTEXT.union(ZarrV3Context(data_types=[PACKED])), and runs in the docs tests.json_schemamodule documents, so a schema for such a context accepts any string.The agent rebased this onto
mainas one commit: the branch had been stacked on theZARR_PYTHON_CONTEXTbranch, which merged upstream as #4583, and the docs example switched from the removedcontext.update(...)tounion.just checkinpackages/zarr-metadatapasses (3696 tests and the strict docs build).🤖 Generated with Claude Code