diff --git a/CHANGELOG.md b/CHANGELOG.md index fd497150e..839da9774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Upcoming +### Improvements +* Added support for Numpy 2 and h5py 3.12, and pinned PyNWB to <3.0 temporarily. [#536](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/536) + ### Fixes * Fixed issue where the description check failed if the description was a list. [#535](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/535) diff --git a/pyproject.toml b/pyproject.toml index 41ed89967..57427a81f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - "pynwb>=2.8", # NWB Inspector should always be used with most recent minor versions of PyNWB + "pynwb>=2.8,<3", # NWB Inspector should always be used with most recent minor versions of PyNWB "hdmf-zarr", "fsspec", "s3fs", @@ -45,8 +45,6 @@ dependencies = [ "click", "tqdm", "isodate", - "numpy>=1.22.0,<2.0.0", # TODO: add compatibility for 2.0 - HDMF Zarr and others also still have some troubles - "h5py<3.12.0", # TODO: remove pin when https://github.com/h5py/h5py/issues/2505 is fixed and released ] [project.optional-dependencies] diff --git a/src/nwbinspector/checks/_tables.py b/src/nwbinspector/checks/_tables.py index 03456febf..8abf956a0 100644 --- a/src/nwbinspector/checks/_tables.py +++ b/src/nwbinspector/checks/_tables.py @@ -155,7 +155,7 @@ def check_column_binary_capability( ["hit", "miss"], ] if any([set(parsed_unique_values) == set(pair) for pair in pairs_to_check]): # type: ignore - saved_bytes = (unique_values.dtype.itemsize - 1) * np.product( + saved_bytes = (unique_values.dtype.itemsize - 1) * np.prod( get_data_shape(data=column.data, strict_no_data_load=True) ) if unique_values.dtype == "float": diff --git a/tests/unit_tests/test_tables.py b/tests/unit_tests/test_tables.py index c15b7d4be..a97c262c0 100644 --- a/tests/unit_tests/test_tables.py +++ b/tests/unit_tests/test_tables.py @@ -4,6 +4,7 @@ import numpy as np from hdmf.common import DynamicTable, DynamicTableRegion +from numpy.lib import NumpyVersion from pynwb.file import Device, ElectrodeGroup, ElectrodeTable, TimeIntervals, Units from nwbinspector import Importance, InspectorMessage @@ -187,7 +188,8 @@ def test_binary_int_fail(self): self.table.add_column(name="test_col", description="") for x in [1, 0, 1, 0, 1]: self.table.add_row(test_col=x) - if platform.system() == "Windows": + # the default numpy int in Windows with NumPy < 2 is int32. otherwise it is int64. + if platform.system() == "Windows" and NumpyVersion(np.__version__) < "2.0.0": platform_saved_bytes = "15.00B" else: platform_saved_bytes = "35.00B"