Skip to content

[Feature]: Create IO Config object to handle common configuration logic #1356

@rly

Description

@rly

What would you like to see added to HDMF?

During discussion of #1123, we thought it would be a nice-to-have to have a config class to handle backend-specific IO configurations. This provides more explicit guidance than the "storage_options" unstructured dict approach taken by fsspec.

Something like the following:

# class HDMFIOConfig(pydantic model / dataclass, frozen=True):
#     # common arguments
#     aws_region: str

# class HDF5IOConfig(HDMFIOConfig):
#     driver: str

#     def __init__(self, aws_region, driver):
#         super().__init__(aws_region)
#         if driver is not None:
#             if driver is not "ros3" and aws_region is not None:
#                 raise ValueError("Incompatible configuration")
#             self.driver = driver
#         else:
#             if aws_region is not None:
#                 # set driver to ros3 if region is provided and driver is not None
#                 self.driver = "ros3

# class ZarrIOConfig(HDMFIOConfig):
#     pass
   

# class HDF5IO:

#     # option 1
#     def __init__(self, io_config: HDF5IOConfig):
#         pass

#     # option 2
#     def __init__(self, path, io, driver, aws_region):
#         # do stuff with HDF5IOConfig(path, io, driver, aws_region)
#         h5py.File(..., driver=config.driver, aws_region=config.aws_region)

What solution would you like?

^

Do you have any interest in helping implement the feature?

Yes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    category: enhancementimprovements of code or code behaviorpriority: lowalternative solution already working and/or relevant to only specific user(s)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions