Skip to content

Commit

Permalink
Remove numpy and h5py restrictions (#536)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Steph Prince <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2024
1 parent 165c727 commit 52b1707
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/nwbinspector/checks/_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 3 additions & 1 deletion tests/unit_tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 52b1707

Please sign in to comment.