Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

provenance_context-0.1.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

provenance_context-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file provenance_context-0.1.0.tar.gz.

File metadata

  • Download URL: provenance_context-0.1.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

Hashes for provenance_context-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4cbf4c3c7c1cdcf16d7c9cc667ec5b976192bd5a4002e6276aa19336db04cc58
MD5 5baa9a4cc81077762b4584254a7e2939
BLAKE2b-256 7467dbb1e19781b1cbff2918d4222ca3d839380bf4290ce042562fd64fca170b

See more details on using hashes here.

File details

Details for the file provenance_context-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for provenance_context-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7dbe38ad352be47580d6d596820d440b94467dea0db43d74e71c4e636b0ee97a
MD5 670c98fe6fcbc9df99930513862a5419
BLAKE2b-256 d8caf857faab0e56795b6776af3abf396f6d0ca7fcca11f8eb56220c8f3f7343

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page