pynwb.io.utils module

pynwb.io.utils.get_nwb_version(builder: Builder, include_prerelease=False) Tuple[int, ...][source]

Get the version of the NWB file from the root of the given builder, as a tuple.

If the “nwb_version” attribute on the root builder equals “2.5.1”, then (2, 5, 1) is returned. If the “nwb_version” attribute on the root builder equals “2.5.1-alpha” and include_prerelease=False, then (2, 5, 1) is returned. If the “nwb_version” attribute on the root builder equals “2.5.1-alpha” and include_prerelease=True, then (2, 5, 1, “alpha”) is returned.

If the “nwb_version” attribute == “2.0b” (the only deviation from semantic versioning in the 2.x series), then if include_prerelease=True, (2, 0, 0, “b”) is returned; else, (2, 0, 0) is returned.

Parameters:
  • builder (Builder) – Any builder within an NWB file.

  • include_prerelease (bool) – Whether to include prerelease information in the returned tuple.

Returns:

The version of the NWB file, as a tuple.

Return type:

tuple

Raises:

ValueError – if the ‘nwb_version’ attribute is missing from the root of the NWB file.