Add check for NWB schema version to ensure official releases#607
Draft
bendichter wants to merge 2 commits intodevfrom
Draft
Add check for NWB schema version to ensure official releases#607bendichter wants to merge 2 commits intodevfrom
bendichter wants to merge 2 commits intodevfrom
Conversation
Add `check_nwb_schema_version_official_release` to validate that NWB files use official release versions rather than development or pre-release versions. This check is configured as CRITICAL for DANDI validation to ensure production data compatibility and reproducibility.
for more information, see https://pre-commit.ci
stephprince
reviewed
Aug 18, 2025
Comment on lines
+36
to
+41
| import pynwb | ||
|
|
||
| # Get the schema version from the namespace catalog | ||
| manager = pynwb.get_manager() | ||
| core_namespace = manager.namespace_catalog.get_namespace("core") | ||
| schema_version = core_namespace.version |
Contributor
There was a problem hiding this comment.
This check uses the loaded namespace from PyNWB to check the schema version validity and not the nwbfile argument provided. I think it would be more direct to check the nwb_version attribute of the nwbfile provided. Thoughts?
Comment on lines
+634
to
+637
| import unittest.mock | ||
|
|
||
| # Test development version | ||
| with unittest.mock.patch("pynwb.get_manager") as mock_manager: |
Contributor
There was a problem hiding this comment.
See the comment on the check, but I think these tests could also be updated/simplified using mock nwbfiles with the nwb_version attribute manually changed instead of patching the namespace manager
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #607 +/- ##
==========================================
+ Coverage 83.16% 87.32% +4.16%
==========================================
Files 47 47
Lines 1562 1578 +16
==========================================
+ Hits 1299 1378 +79
+ Misses 263 200 -63
🚀 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.
Add
check_nwb_schema_version_official_releaseto validate that NWB files use official release versions rather than development or pre-release versions. This check is configured as CRITICAL for DANDI validation to ensure production data compatibility and reproducibility.Motivation
fix #432