Make HERDManager an abstract interface#1431
Merged
Merged
Conversation
- Make HERDManager an ABC with abstract external_resources property. Subclasses must declare external_resources in their __fields__ (or __nwbfields__) to satisfy the interface and get auto-generated getter/setter. - Update __gather_fields to override inherited abstract properties with auto-generated ones and clear __abstractmethods__ accordingly. - Remove _gather_mixin_fields (no longer needed since subclasses declare fields themselves). - Update all HERDManager subclasses to declare external_resources in their __fields__. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1431 +/- ##
==========================================
+ Coverage 93.10% 93.13% +0.02%
==========================================
Files 41 41
Lines 10038 10047 +9
Branches 2061 2063 +2
==========================================
+ Hits 9346 9357 +11
+ Misses 416 415 -1
+ Partials 276 275 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Optional tests, pynwb tests, and hdmf-zarr tests are expected to fail until the PyNWB 4 release. |
oruebel
previously approved these changes
Mar 23, 2026
Move linked HERD functionality from NWBFile to HERDManager base class so any HERDManager subclass can manage a secondary linked HERD alongside the primary one. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
oruebel
approved these changes
Mar 24, 2026
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.
Motivation
HERDManagerwas previously a concrete mixin that used a private_herdattribute with a manual property, bypassing the__fields__/ child-tracking system entirely. This PR refactors it into an abstract interface (ABC) that:external_resourcesproperty, requiring subclasses to provide the implementationexternal_resourcesin their__fields__(or__nwbfields__), which triggers auto-generated getter/setter via__gather_fieldsisinstancechecks in HERD and HDMFIOThis design is cleaner because:
required_name,child, etc. as neededexternal_resourcescan now be a proper child field with parent tracking in container subclasses like NWBFile__gather_fieldsis updated to allow auto-generated properties to override inherited abstract properties, clearing__abstractmethods__accordingly.Additionally,
link_resourcesandget_external_resourcesmethods are added toHERDManagerso that any subclass can manage a secondary linked HERD alongside the primary one. This moves functionality that was previously NWBFile-specific into the base class for broader reuse.This PR will make the corresponding PyNWB PR NeurodataWithoutBorders/pynwb#2111 cleaner.
How to test the behavior?
Checklist
CHANGELOG.mdwith your changes?