[Feature]: Global or IO-specific TypeConfigurator? #1087
Labels
category: enhancement
improvements of code or code behavior
priority: wontfix
will not be fixed due to low priority and/or conflict with other feature/priority
What would you like to see added to HDMF?
Following up on the discussion at the end of #1016
Currently, there is one
TypeConfigurator
object that is passed around between allTypeMap
objects.For reading data: in NWB, when a user opens a file with an extension A, the IO object uses a copy of the global
TypeMap
with hdmf-common and nwb core loaded, and it loads extension A into that copy.If during the same Python execution, another file is opened with an extension B, the IO object for that file uses a fresh copy of the global
TypeMap
and it loads extension B into that copy. This copy does not contain extension A.For writing data: When a user writes an NWB file, by default, the IO object uses a fresh copy of the global
TypeMap
and users have generally loaded extensions into the globalTypeMap
. This approach is not ideal when writing/editing multiple files that use different extensions because they can interfere with each other, but rarely does anyone do that, so it has not been a problem. A user who wants to isolate their loaded extensions can callget_type_map
andget_manager
to get independent copies ofTypeMap
andBuildManager
objects.The
TypeConfigurator
manages a single dict with the configs for all namespaces. Loading a new config file updates that dict for each namespace described in the file, and the config can be cleared.Should IO objects interact with
TypeConfigurator
in the same way asTypeMap
, where a copy is created and modified?Principally, I think different IO objects should be able to have different
TypeConfigurator
objects without having to reset the global one. But, that would be confusing (understandingTypeMap
and managing separateTypeMap
objects is not intended for the average user). And right now it doesn't matter, because I believeTypeConfigurator
performs validation only on write and using multiple IO objects that involve different extensions is a rare use case. We also do not totally know how thisTypeConfigurator
will be used. So, I think we need not change the behavior unless an issue comes up. I'll close this issue, but we can use this space to discuss.What solution would you like?
None
Do you have any interest in helping implement the feature?
No.
The text was updated successfully, but these errors were encountered: