From 79797051bff1c789c84031274a8fe089fa702fae Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Fri, 17 May 2024 15:27:50 -0700 Subject: [PATCH 1/4] Expose AWS Region to NWBHDF5IO --- src/pynwb/__init__.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 9ea18efb8..10efc6fe2 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -254,16 +254,11 @@ def can_read(path: str): {'name': 'extensions', 'type': (str, TypeMap, list), 'doc': 'a path to a namespace, a TypeMap, or a list consisting paths to namespaces and TypeMaps', 'default': None}, - {'name': 'file', 'type': [h5py.File, 'S3File'], 'doc': 'a pre-existing h5py.File object', 'default': None}, - {'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': 'herd_path', 'type': str, 'doc': 'The path to the HERD', - 'default': None},) + *get_docval(_HDF5IO.__init__, "file", "comm", "driver", "aws_region", "herd_path"),) def __init__(self, **kwargs): - path, mode, manager, extensions, load_namespaces, file_obj, comm, driver, herd_path =\ + path, mode, manager, extensions, load_namespaces, file_obj, comm, driver, aws_region, herd_path =\ popargs('path', 'mode', 'manager', 'extensions', 'load_namespaces', - 'file', 'comm', 'driver', 'herd_path', kwargs) + 'file', 'comm', 'driver', 'aws_region', 'herd_path', kwargs) # Define the BuildManager to use io_modes_that_create_file = ['w', 'w-', 'x'] if mode in io_modes_that_create_file or manager is not None or extensions is not None: @@ -289,7 +284,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, herd_path=herd_path) + driver=driver, aws_region=aws_region, herd_path=herd_path) @property def nwb_version(self): From 9f92f234946cf544850dad7e31c56bc2040dcf10 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Fri, 17 May 2024 19:11:29 -0700 Subject: [PATCH 2/4] Add aws_region to HDF5IO.load_namespaces calls --- src/pynwb/__init__.py | 2 +- src/pynwb/validate.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 10efc6fe2..ada39764e 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -266,7 +266,7 @@ def __init__(self, **kwargs): if load_namespaces: tm = get_type_map() - super().load_namespaces(tm, path, file=file_obj, driver=driver) + super().load_namespaces(tm, path, file=file_obj, driver=driver, aws_region=aws_region) manager = BuildManager(tm) # XXX: Leaving this here in case we want to revert to this strategy for diff --git a/src/pynwb/validate.py b/src/pynwb/validate.py index 827249cbb..aecfb2556 100644 --- a/src/pynwb/validate.py +++ b/src/pynwb/validate.py @@ -30,7 +30,7 @@ def _validate_helper(io: HDMFIO, namespace: str = CORE_NAMESPACE) -> list: def _get_cached_namespaces_to_validate( - path: str, driver: Optional[str] = None + path: str, driver: Optional[str] = None, aws_region: Optional[str] = None, ) -> Tuple[List[str], BuildManager, Dict[str, str]]: """ Determine the most specific namespace(s) that are cached in the given NWBFile that can be used for validation. @@ -58,7 +58,12 @@ def _get_cached_namespaces_to_validate( catalog = NamespaceCatalog( group_spec_cls=NWBGroupSpec, dataset_spec_cls=NWBDatasetSpec, spec_namespace_cls=NWBNamespace ) - namespace_dependencies = NWBHDF5IO.load_namespaces(namespace_catalog=catalog, path=path, driver=driver) + namespace_dependencies = NWBHDF5IO.load_namespaces( + namespace_catalog=catalog, + path=path, + driver=driver, + aws_region=aws_region + ) # Determine which namespaces are the most specific (i.e. extensions) and validate against those candidate_namespaces = set(namespace_dependencies.keys()) From 862e758a8115c80195aaec5fe6fa2d758ae9c32e Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Mon, 20 May 2024 20:52:58 -0700 Subject: [PATCH 3/4] Use latest hdmf==3.14.0 --- environment-ros3.yml | 2 +- pyproject.toml | 2 +- requirements-min.txt | 2 +- requirements.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/environment-ros3.yml b/environment-ros3.yml index 8c93623bc..92e17b5dd 100644 --- a/environment-ros3.yml +++ b/environment-ros3.yml @@ -6,7 +6,7 @@ channels: dependencies: - python==3.12 - h5py==3.11.0 - - hdmf==3.13.0 + - hdmf==3.14.0 - matplotlib==3.8.0 - numpy==1.26.4 - pandas==2.2.1 diff --git a/pyproject.toml b/pyproject.toml index ab2fceb33..4701ca7d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ ] dependencies = [ "h5py>=2.10", - "hdmf>=3.12.2", + "hdmf>=3.14.0", "numpy>=1.18, <2.0", # pin below 2.0 until HDMF supports numpy 2.0 "pandas>=1.1.5", "python-dateutil>=2.7.3", diff --git a/requirements-min.txt b/requirements-min.txt index f6b765b0b..a047d81c7 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.12.2 +hdmf==3.14.0 numpy==1.18 pandas==1.1.5 python-dateutil==2.7.3 diff --git a/requirements.txt b/requirements.txt index dd152ad16..c1fd347ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # pinned dependencies to reproduce an entire development environment to use PyNWB h5py==3.11.0 -hdmf==3.13.0 +hdmf==3.14.0 numpy==1.26.4 pandas==2.2.1 python-dateutil==2.9.0.post0 From 9dc816ad9f1f9179de1a28ecc5fc21701b6553ef Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 22 May 2024 11:13:52 -0700 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f61a0587..d357c8168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Enhancements and minor changes - Set rate default value inside `mock_ElectricalSeries` to avoid having to set `rate=None` explicitly when passing timestamps. @h-mayorquin [#1894](https://github.com/NeurodataWithoutBorders/pynwb/pull/1894) +- Exposed `aws_region` to `NWBHDF5IO`. @rly [#1903](https://github.com/NeurodataWithoutBorders/pynwb/pull/1903) ## PyNWB 2.7.0 (May 2, 2024)