datahipy.utils
The datahipy.utils
subpackage contains modules that define utility functions.
datahipy.utils.versioning
Methods supporting versioning of BIDS and Collaborative project datasets.
- datahipy.utils.versioning.checkout_tag(input_data)[source]
Checkout a specific tag of a dataset managed by Git/Datalad via subprocess.
- Note: The master / main branch / or the HEAD can also be checked out by specifying
“master” / “main” / “HEAD” for the tag value.
Parameters
- input_datadict
Dictionary containing the input data for the command in the format:
{ "path": "/path/to/dataset", "tag": "1.0.0", }
- datahipy.utils.versioning.create_tag(input_data)[source]
Create a version tag on a dataset managed by Git/Datalad.
Note: The tag is created on a Datalad dataset, not on a specific file. If the dataset is a BIDS dataset, the tag will be created only on this dataset. If the dataset is a Collaborative Project, the tag will be created recursively on
the project dataset and on the nested BIDS dataset of the project.
Parameters
- input_datadict
Dictionary or JSON file containing the input data for the command in the format:
{ "path": "/path/to/dataset", "type": "bids", # or "project" "tag": "1.0.0", "changes_list": ["Change 1", "Change 2"] }
- datahipy.utils.versioning.get_latest_tag(path)[source]
Get the latest tag of a dataset managed by Git/Datalad.
Parameters
- pathstr
Absolute path to the dataset.
Returns
- str
The latest tag of the dataset.
- datahipy.utils.versioning.get_tags(input_data, output_file)[source]
Get the list of tags of a dataset managed by Git/Datalad via subprocess.
Parameters
- input_datadict
Dictionary containing the input data for the command in the format:
{ "path": "/path/to/dataset", }
- output_filestr
Absolute path to the output JSON file containing the tags in the format:
{ "path": "/path/to/dataset", "tags": ["1.0.0", "1.0.1", "1.1.0"] }
- datahipy.utils.versioning.increment_tag(tag, level)[source]
Increment a version tag by a specific level.
Parameters
- tagstr
Version tag to increment in the format X.Y.Z, where X, Y, and Z are integers.
- levelstr
Level to increment. Can be “major”, “minor”, or “patch”.
Returns
- str
The incremented tag.
- datahipy.utils.versioning.release_version(input_data, output_file)[source]
Release a new version of a project / BIDS dataset managed by Git/Datalad.
Note: The tag is created on a Datalad dataset, not on a specific file. If the dataset is a BIDS dataset, the tag will be created only on this dataset. If the dataset is a Collaborative Project, the tag will be created recursively on
the project dataset and on the nested BIDS dataset of the project.
Parameters
- input_datadict
Dictionary containing the input data for the command in the format:
{ "path": "/path/to/dataset", "type": "bids", # or "project" "level": "major", # or "minor" or "patch" "changes_list": ["Change 1", "Change 2"] }
- output_filestr
Absolute path to the output JSON file containing the dataset summary generated by
datahipy.bids.dataset.get_bidsdataset_content()
.