Skip to main content

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

Release files for provenance-context 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for provenance-context 0.2.0
File Size Uploaded
provenance_context-0.2.0.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for provenance-context 0.2.0
File Interpreter ABI Platform
provenance_context-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / provenance_context-0.2.0.tar.gz

Download URL provenance_context-0.2.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f7bd76edc2f628bbe69c130577d9dbd76bce6fb1453c6082486441ce3709992b
BLAKE2b-256 checksum
How to use checksums
e9af58dc11f1be16eec637f7b92639cea6e758662d6b12ed59b132073383cace
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / provenance_context-0.2.0-py3-none-any.whl

Download URL provenance_context-0.2.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afade233f7a37acbce8b54de9a1cbb7afa14a8a7d1cd083309b2eca037199c85
BLAKE2b-256 checksum
How to use checksums
25b9e89d51577ff285c020e632ce7ed3164ac3a3c13014643b85abaac1cbcbca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page