Python library for the consumption of information in provenance file format (pff).
Definition of the format is given in https://github.com/eScienceLab/provenance-file-format
Currently this package is installable only from source. To do this, prepare your python virtual environment, then install using:
python -m pip install .For development work, install this library in editable mode:
python -m pip install -e .The library makes use of the environment variable PFFPATH, which should define the locations of all provenance files of interest. These paths should be separated with a :.
The library will load this directly, or it can be overridden by the calling program, e.g:
from provff_py import ProvData
pffPath = '~/:/opt/provenance/'
provData = ProvData(pffPath)The library will record the locations of all provenance files within these locations:
> print(provData.provSourceFiles)
[PosixPath('~/user.pff'),PosixPath('/opt/provenance/project.pff')]Provenance information is not loaded until requested. The provenance to be loaded is specified using one or more key terms. The provenance source files are searched in order for these terms, and the first data object identified with each key term will be loaded. Only one record will be loaded for each key term. The loaded provenance data is stored as a dictionary.
> provData.load_pff_data(['user', 'project'])
> print(provData.serviceData)
{'project': {'description': 'Fictional research programme in psychoceramics, '
'the supposed study of cracked pots. Professor '
'Carberry is said to still teach at Brown '
'University.\n',
'id': 'psychoceramics',
'start_date': '1929-04-01',
'title': 'Psychoceramics: The Study of Cracked Pots'},
'user': {'full_name': 'Josiah Stinkney Carberry',
'id': 'jcarberry',
'orcid': 'https://orcid.org/0000-0002-1825-0097'}}