Skip to content

refactor: bring in types from zarr-metadata#3961

Open
d-v-b wants to merge 30 commits into
zarr-developers:mainfrom
d-v-b:use-zarr-metadata
Open

refactor: bring in types from zarr-metadata#3961
d-v-b wants to merge 30 commits into
zarr-developers:mainfrom
d-v-b:use-zarr-metadata

Conversation

@d-v-b
Copy link
Copy Markdown
Contributor

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

replaces some of our types with exports from zarr-metadata. I expect a few related PRs, alternating between ones like this (importing types) and ones that add missing types to zarr-metadata.

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.md
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions Bot added the needs release notes Automatically applied to PRs which haven't added release notes label May 10, 2026
@d-v-b d-v-b requested a review from ilan-gold May 10, 2026 08:38
@d-v-b
Copy link
Copy Markdown
Contributor Author

d-v-b commented May 10, 2026

cc @chuckwondo

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.28%. Comparing base (7e58df0) to head (cecf79e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3961      +/-   ##
==========================================
- Coverage   93.29%   93.28%   -0.02%     
==========================================
  Files          87       87              
  Lines       11753    11742      -11     
==========================================
- Hits        10965    10953      -12     
- Misses        788      789       +1     
Files with missing lines Coverage Δ
src/zarr/codecs/blosc.py 95.74% <100.00%> (-0.03%) ⬇️
src/zarr/codecs/cast_value.py 98.58% <100.00%> (-0.02%) ⬇️
src/zarr/core/group.py 94.99% <100.00%> (+0.01%) ⬆️
src/zarr/core/metadata/v2.py 88.95% <100.00%> (-0.07%) ⬇️
src/zarr/core/metadata/v3.py 93.69% <100.00%> (-0.17%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pyproject.toml Outdated
@d-v-b d-v-b mentioned this pull request May 11, 2026
d-v-b added 5 commits May 11, 2026 16:39
- set `zarr-metadata` to resolve locally in local development
- add a section to the docs outlining the relationship between zarr and zarr-metadata packages
…e the lower zarr-metadata bound is published
@github-actions github-actions Bot removed the needs release notes Automatically applied to PRs which haven't added release notes label May 13, 2026
@d-v-b
Copy link
Copy Markdown
Contributor Author

d-v-b commented May 15, 2026

we should not merge this until #3972 is sorted out. that PR switches our pre-commit mypy check to run in a locked environment, which can include the package-local copy of zarr-metadata. Without that PR, mypy in pre-commit would run against the version of zarr-metadata on pypi, which would generate false alarms when we pushed pre-release changes to zarr-metadata + zarr-python.

Comment thread packages/zarr-metadata/src/zarr_metadata/v3/codec/bytes.py Outdated
Comment thread packages/zarr-metadata/src/zarr_metadata/v3/codec/gzip.py
Comment thread src/zarr/core/group.py
Comment on lines +450 to +451
if self.zarr_format == 2:
result.pop("node_type", None)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node_type is not a valid field in v2 group metadata, so arguably this was a bug. but we also don't use to_dict for creating our v2 metadata, so while correct, this change doesn't fix any broken behavior.

Comment thread tests/test_array.py
d-v-b and others added 5 commits May 15, 2026 22:44
These constants were added to zarr-metadata in-tree on this branch
(commit 08334d4). zarr-python cannot consume them until they appear
in the zarr-metadata version pinned by the project floor — the
min_deps env caught this when it installed zarr-metadata==0.1.1 from
PyPI and pytest blew up on import.

Reverting the test-side adoption here. The constants will be split
out into a separate PR against main and consumed once released.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…data

After reverting a83537c from this branch, BytesCodecObject in
zarr-metadata 0.1.1 (the project floor) still requires `configuration`.
The bare `{"name": "bytes"}` form is correct per spec and at runtime,
but doesn't type-check against the strict 0.1.1 shape. Drop the
annotation here; the field-relaxation fix has been split out to a
separate PR against main.

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.

3 participants