Skip to content

Commit b9f9e5a

Browse files
authored
Prepare for release of PyNWB 2.8.2 (#1960)
* update changelog * update dependencies * update requirements-doc.txt * revert opt requirements update * update numpy requirement * update environment * add family driver file validation, ignore dandi file validation * revert warning filtering in validation * Update CHANGELOG.md * Update environment-ros3.yml
1 parent 6196568 commit b9f9e5a

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PyNWB Changelog
22

3-
## PyNWB 2.8.2 (Upcoming)
3+
## PyNWB 2.8.2 (September 9, 2024)
44

55
### Enhancements and minor changes
66
- Added support for numpy 2.0. @mavaylon1 [#1956](https://github.com/NeurodataWithoutBorders/pynwb/pull/1956)

environment-ros3.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ channels:
66
dependencies:
77
- python==3.12
88
- h5py==3.11.0
9-
- hdmf==3.14.1
10-
- matplotlib==3.8.0
11-
- numpy==1.26.4
9+
- hdmf==3.14.3
10+
- matplotlib==3.8.4
11+
- numpy==2.1.1
1212
- pandas==2.2.2
1313
- python-dateutil==2.9.0
1414
- setuptools

test.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
import argparse
55
import glob
6+
import h5py
67
import inspect
78
import logging
89
import os.path
@@ -152,6 +153,9 @@ def validate_nwbs():
152153
logging.info('running validation tests on NWB files')
153154
examples_nwbs = glob.glob('*.nwb')
154155

156+
# exclude files downloaded from dandi, validation of those files is handled by dandisets-health-status checks
157+
examples_nwbs = [x for x in examples_nwbs if not x.startswith('sub-')]
158+
155159
import pynwb
156160
from pynwb.validate import get_cached_namespaces_to_validate
157161

@@ -162,15 +166,34 @@ def validate_nwbs():
162166
ws = list()
163167
with warnings.catch_warnings(record=True) as tmp:
164168
logging.info("Validating with pynwb.validate method.")
165-
with pynwb.NWBHDF5IO(nwb, mode='r') as io:
166-
errors = pynwb.validate(io)
167-
TOTAL += 1
169+
is_family_nwb_file = False
170+
try:
171+
with pynwb.NWBHDF5IO(nwb, mode='r') as io:
172+
errors = pynwb.validate(io)
173+
except OSError as e:
174+
# if the file was created with the family driver, need to use the family driver to open it
175+
if 'family driver should be used' in str(e):
176+
is_family_nwb_file = True
177+
match = re.search(r'(\d+)', nwb)
178+
filename_pattern = nwb[:match.start()] + '%d' + nwb[match.end():] # infer the filename pattern
179+
memb_size = 1024**2 # note: the memb_size must be the same as the one used to create the file
180+
with h5py.File(filename_pattern, mode='r', driver='family', memb_size=memb_size) as f:
181+
with pynwb.NWBHDF5IO(file=f, manager=None, mode='r') as io:
182+
errors = pynwb.validate(io)
183+
else:
184+
raise e
185+
186+
TOTAL += 1
187+
188+
if errors:
189+
FAILURES += 1
190+
ERRORS += 1
191+
for err in errors:
192+
print("Error: %s" % err)
168193

169-
if errors:
170-
FAILURES += 1
171-
ERRORS += 1
172-
for err in errors:
173-
print("Error: %s" % err)
194+
# if file was created with family driver, skip pynwb.validate CLI because not yet supported
195+
if is_family_nwb_file:
196+
continue
174197

175198
namespaces, _, _ = get_cached_namespaces_to_validate(nwb)
176199

0 commit comments

Comments
 (0)