pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

Store the git hash of the nwb-schema submodule in the NWBFile

Open rly opened this issue 5 years ago • 3 comments

Description

In the event that the nwb-schema submodule of PyNWB is accidentally updated to a non-release version (the default git branches of nwb-schema and hdmf-common-schema contain the bleeding edge and not necessarily the latest release), then storing the git hash of the loaded submodule in the file would help decipher which unreleased version of the schema was used.

Note: the current workflow requires that all unreleased versions of the schema (the state of the default branches of those repos) have the suffix "-alpha" in the version string. This helps determine that an unreleased version of the schema was used, but does not differentiate between multiple commits that occur between schema releases. The suffix "-alpha" might also be accidentally forgotten. Storing the git hash will solve both issues.

It would also be nice to store the version of PyNWB (or git hash) in the NWBFile.

Proposed solution

Modify 'package_data' in setup.py to store the git hash of the nwb-schema submodule as a resource: https://github.com/NeurodataWithoutBorders/pynwb/blob/9d734631c680d6e5bb430d806cd21d2651f093d8/setup.py#L36

Load the git hash and store it in the file. See as example: https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/src/pynwb/init.py#L24-L28

rly avatar May 18 '20 21:05 rly

The NWBFile will need a place to store this information.

I think adding an attribute is a logical place to do that.

https://github.com/NeurodataWithoutBorders/nwb-schema/blob/7931e59ad1e97433ce4a450fa5bc2dab81af6f8d/core/nwb.file.yaml#L7-L12

ajtritt avatar May 18 '20 21:05 ajtritt

I think adding an attribute is a logical place to do that.

Just for clarification do you envision this to be an attribute on the NWBFile (like nwb_version) or as an attribute on the group with the cached schema?

oruebel avatar May 18 '20 21:05 oruebel

On the NWBFile

ajtritt avatar May 18 '20 22:05 ajtritt