From 68c4f5645d00f3958471e5e2bc360c90f49a4740 Mon Sep 17 00:00:00 2001 From: Matthew Avaylon Date: Fri, 18 Aug 2023 15:20:11 -0700 Subject: [PATCH] Release 2.5.0/ Update ExternalResources to HERD (#1754) * Update ExternalResources to HERD * Update setup.py * Update requirements.txt * Update requirements-min.txt * Update environment-ros3.yml * Update CHANGELOG.md * Update environment-ros3.yml * Update run_tests.yml * Update run_all_tests.yml * Update run_tests.yml * Update run_all_tests.yml * Update run_all_tests.yml * Update run_tests.yml --- .github/workflows/run_all_tests.yml | 6 +++++- .github/workflows/run_tests.yml | 4 ++++ CHANGELOG.md | 3 ++- environment-ros3.yml | 2 +- requirements-min.txt | 2 +- requirements.txt | 2 +- setup.py | 2 +- src/pynwb/__init__.py | 8 ++++---- src/pynwb/file.py | 4 ++-- src/pynwb/resources.py | 10 +++++++--- tests/unit/test_resources.py | 6 +++--- 11 files changed, 31 insertions(+), 18 deletions(-) diff --git a/.github/workflows/run_all_tests.yml b/.github/workflows/run_all_tests.yml index 781822258..0e9d9b131 100644 --- a/.github/workflows/run_all_tests.yml +++ b/.github/workflows/run_all_tests.yml @@ -108,6 +108,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Python uses: actions/setup-python@v4 @@ -151,6 +152,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Conda uses: conda-incubator/setup-miniconda@v2 @@ -207,6 +209,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Conda uses: conda-incubator/setup-miniconda@v2 @@ -253,6 +256,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Conda uses: conda-incubator/setup-miniconda@v2 @@ -278,4 +282,4 @@ jobs: - name: Run gallery ros3 tests run: | - python test.py --example-ros3 \ No newline at end of file + python test.py --example-ros3 diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index d2a492496..89793901d 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -92,6 +92,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Python uses: actions/setup-python@v4 @@ -184,6 +185,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Conda uses: conda-incubator/setup-miniconda@v2 @@ -228,6 +230,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Conda uses: conda-incubator/setup-miniconda@v2 @@ -271,6 +274,7 @@ jobs: uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Python uses: actions/setup-python@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index d65a51af7..9016dbb2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # PyNWB Changelog -## PyNWB 2.5.0 (Upcoming) +## PyNWB 2.5.0 (August 18, 2023) ### Enhancements and minor changes - Add `TimeSeries.get_timestamps()`. @bendichter [#1741](https://github.com/NeurodataWithoutBorders/pynwb/pull/1741) - Add `TimeSeries.get_data_in_units()`. @bendichter [#1745](https://github.com/NeurodataWithoutBorders/pynwb/pull/1745) +- Updated `ExternalResources` name change to `HERD`, along with HDMF 3.9.0 being the new minimum. @mavaylon1 [#1754](https://github.com/NeurodataWithoutBorders/pynwb/pull/1754) ### Documentation and tutorial enhancements - Updated streaming tutorial to ensure code is run on tests and clarify text. @bendichter [#1760](https://github.com/NeurodataWithoutBorders/pynwb/pull/1760) @oruebel [#1762](https://github.com/NeurodataWithoutBorders/pynwb/pull/1762) diff --git a/environment-ros3.yml b/environment-ros3.yml index cf7bdafea..ae15e985c 100644 --- a/environment-ros3.yml +++ b/environment-ros3.yml @@ -15,4 +15,4 @@ dependencies: - dandi==0.55.1 # NOTE: dandi does not support osx-arm64 - fsspec==2023.6.0 - requests==2.28.1 - - aiohttp==3.8.3 \ No newline at end of file + - aiohttp==3.8.3 diff --git a/requirements-min.txt b/requirements-min.txt index 662133bd5..8f52348f1 100644 --- a/requirements-min.txt +++ b/requirements-min.txt @@ -1,6 +1,6 @@ # minimum versions of package dependencies for installing PyNWB h5py==2.10 # support for selection of datasets with list of indices added in 2.10 -hdmf==3.8.0 +hdmf==3.9.0 numpy==1.18 pandas==1.1.5 python-dateutil==2.7.3 diff --git a/requirements.txt b/requirements.txt index 4c0cf18fd..2ad7b813e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # pinned dependencies to reproduce an entire development environment to use PyNWB h5py==3.8.0 -hdmf==3.8.0 +hdmf==3.9.0 numpy==1.24.2 pandas==2.0.0 python-dateutil==2.8.2 diff --git a/setup.py b/setup.py index 8a5010d6d..90aebf55f 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ reqs = [ 'h5py>=2.10', - 'hdmf>=3.8.0', + 'hdmf>=3.9.0', 'numpy>=1.16', 'pandas>=1.1.5', 'python-dateutil>=2.7.3', diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 181079970..a6195e779 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -216,12 +216,12 @@ class NWBHDF5IO(_HDF5IO): {'name': 'comm', 'type': "Intracomm", 'doc': 'the MPI communicator to use for parallel I/O', 'default': None}, {'name': 'driver', 'type': str, 'doc': 'driver for h5py to use when opening HDF5 file', 'default': None}, - {'name': 'external_resources_path', 'type': str, 'doc': 'The path to the ExternalResources', + {'name': 'herd_path', 'type': str, 'doc': 'The path to the HERD', 'default': None},) def __init__(self, **kwargs): - path, mode, manager, extensions, load_namespaces, file_obj, comm, driver, external_resources_path =\ + path, mode, manager, extensions, load_namespaces, file_obj, comm, driver, herd_path =\ popargs('path', 'mode', 'manager', 'extensions', 'load_namespaces', - 'file', 'comm', 'driver', 'external_resources_path', kwargs) + 'file', 'comm', 'driver', 'herd_path', kwargs) # Define the BuildManager to use if load_namespaces: if manager is not None: @@ -251,7 +251,7 @@ def __init__(self, **kwargs): manager = get_manager() # Open the file super().__init__(path, manager=manager, mode=mode, file=file_obj, comm=comm, - driver=driver, external_resources_path=external_resources_path) + driver=driver, herd_path=herd_path) @property def nwb_version(self): diff --git a/src/pynwb/file.py b/src/pynwb/file.py index b03141b7f..b473e571a 100644 --- a/src/pynwb/file.py +++ b/src/pynwb/file.py @@ -8,7 +8,7 @@ import pandas as pd from hdmf.common import DynamicTableRegion, DynamicTable -from hdmf.container import ExternalResourcesManager +from hdmf.container import HERDManager from hdmf.utils import docval, getargs, get_docval, popargs, popargs_to_dict, AllowPositional from . import register_class, CORE_NAMESPACE @@ -150,7 +150,7 @@ def __init__(self, **kwargs): @register_class('NWBFile', CORE_NAMESPACE) -class NWBFile(MultiContainerInterface, ExternalResourcesManager): +class NWBFile(MultiContainerInterface, HERDManager): """ A representation of an NWB file. """ diff --git a/src/pynwb/resources.py b/src/pynwb/resources.py index bfb8a6ba2..acdc22b12 100644 --- a/src/pynwb/resources.py +++ b/src/pynwb/resources.py @@ -1,10 +1,14 @@ -from hdmf.common import ExternalResources as hdmf_ExternalResources +from hdmf.common import HERD as hdmf_HERD from . import get_type_map as tm from hdmf.utils import docval, get_docval -class ExternalResources(hdmf_ExternalResources): - @docval(*get_docval(hdmf_ExternalResources.__init__)) +class HERD(hdmf_HERD): + """ + HDMF External Resources Data Structure. + A table for mapping user terms (i.e. keys) to resource entities. + """ + @docval(*get_docval(hdmf_HERD.__init__)) def __init__(self, **kwargs): kwargs['type_map'] = tm() super().__init__(**kwargs) diff --git a/tests/unit/test_resources.py b/tests/unit/test_resources.py index cfb598b7b..e04f5c653 100644 --- a/tests/unit/test_resources.py +++ b/tests/unit/test_resources.py @@ -1,4 +1,4 @@ -from pynwb.resources import ExternalResources +from pynwb.resources import HERD from pynwb.testing import TestCase @@ -7,5 +7,5 @@ def test_constructor(self): """ Test constructor """ - er = ExternalResources() - self.assertIsInstance(er, ExternalResources) + er = HERD() + self.assertIsInstance(er, HERD)