Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Global or IO-specific TypeConfigurator? #1087

Closed
rly opened this issue Mar 28, 2024 · 1 comment
Closed

[Feature]: Global or IO-specific TypeConfigurator? #1087

rly opened this issue Mar 28, 2024 · 1 comment
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

Comments

@rly
Copy link
Contributor

rly commented Mar 28, 2024

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 all TypeMap 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 global TypeMap. 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 call get_type_map and get_manager to get independent copies of TypeMap and BuildManager 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 as TypeMap, 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 (understanding TypeMap and managing separate TypeMap objects is not intended for the average user). And right now it doesn't matter, because I believe TypeConfigurator 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 this TypeConfigurator 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.

@rly
Copy link
Contributor Author

rly commented Mar 28, 2024

cc @mavaylon1 @oruebel

@rly rly closed this as completed Mar 28, 2024
@rly rly added 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 labels Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant