Skip to content

feat: add parent property to Group and Array - #4659

Open
hereiszepedro wants to merge 3 commits into
zarr-developers:mainfrom
hereiszepedro:group-array-parent
Open

hereiszepedro wants to merge 3 commits into
zarr-developers:mainfrom
hereiszepedro:group-array-parent

Conversation

@hereiszepedro

@hereiszepedro hereiszepedro commented Nov 25, 2026 •

Copy link
Copy Markdown

Summary

Closes #166.

Group.parent and Array.parent return the group that contains the node, or None at the root of the store. This follows the h5py .parent convention and allows navigating up a hierarchy.

The parent is opened from the store each time the property is read, with the same Zarr format as the child.

For reviewers

  • I only added it to the sync classes, since a property can't await. Happy to add an async method to AsyncGroup/AsyncArray if you want it.
  • If the parent has no metadata in the store (for example a Zarr v3 hierarchy written without intermediate zarr.json documents), reading parent raises the same error as Group.open on that path. I did not add special handling for that case.

Author attestation

  • I am a human, these are my changes, and I have reviewed and understood every change and can explain why each is correct.

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)

@hereiszepedro
hereiszepedro marked this pull request as ready for review November 25, 2026 18:57
@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.91%. Comparing base (593d394) to head (1de6bf0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4659   +/-   ##
=======================================
  Coverage   94.91%   94.91%           
=======================================
  Files          96       96           
  Lines       14070    14082   +12     
=======================================
+ Hits        13354    13366   +12     
  Misses        716      716           
Files with missing lines Coverage Δ
src/zarr/core/array.py 98.60% <100.00%> (+<0.01%) ⬆️
src/zarr/core/group.py 95.72% <100.00%> (+0.03%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

Parent property

1 participant