Python library for querying RO-Crate provenance metadata from CWL workflow runs. Provides lineage queries, site artifacts, and TOON encoding for LLM prompts.
Project description
provenance-context
Python library for querying RO-Crate provenance metadata from CWL workflow runs. Provides lineage queries, site artifacts, and TOON encoding for LLM prompts.
Installation
pip install provenance-context
For optional dependencies:
# Pandas support
pip install provenance-context[pandas]
# TOON encoding support (not available on PyPI, install from GitHub)
pip install git+https://github.com/toon-format/toon-python.git
# Or install both
pip install provenance-context[pandas]
pip install git+https://github.com/toon-format/toon-python.git
Usage
from provenance_context import ProvenanceCrate
# Load a RO-Crate
crate = ProvenanceCrate.from_dir("path/to/crate")
# or
crate = ProvenanceCrate.from_file("path/to/ro-crate-metadata.json")
# Query lineage
lineage = crate.get_file_lineage("output.csv")
site = crate.get_site_artifacts("site_id")
ancestry = crate.get_file_ancestry("output.csv")
descendants = crate.get_file_descendants("input.geojson")
# Encode as TOON for LLM prompts (requires toon-format)
toon_lineage = crate.to_toon_file_lineage("output.csv")
toon_site = crate.to_toon_site_summary("site_id")
Features
- Lineage Queries: Query direct lineage, ancestry (upstream), and descendants (downstream) of files
- Site Artifacts: Get a site-centric view of provenance data
- TOON Encoding: Encode provenance data into TOON format for efficient LLM prompts
- File Resolution: Resolve RO-Crate File entities to local filesystem paths
- Media Type Detection: Automatically detect file types from metadata or extensions
Documentation
See provenance_toon_cheatsheet.md for detailed usage examples and patterns.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file provenance_context-0.2.0.tar.gz.
File metadata
- Download URL: provenance_context-0.2.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7bd76edc2f628bbe69c130577d9dbd76bce6fb1453c6082486441ce3709992b
|
|
| MD5 |
2716d5d8fe4bf7909559381e303dd1cb
|
|
| BLAKE2b-256 |
e9af58dc11f1be16eec637f7b92639cea6e758662d6b12ed59b132073383cace
|
File details
Details for the file provenance_context-0.2.0-py3-none-any.whl.
File metadata
- Download URL: provenance_context-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afade233f7a37acbce8b54de9a1cbb7afa14a8a7d1cd083309b2eca037199c85
|
|
| MD5 |
06396013bddbd7e7aba030d47ab668fa
|
|
| BLAKE2b-256 |
25b9e89d51577ff285c020e632ce7ed3164ac3a3c13014643b85abaac1cbcbca
|