prov
A Python implementation of the W3C PROV Data Model, with
import and export in PROV-N, PROV-JSON, PROV-JSONLD, PROV-XML and PROV-O (RDF). It is
MIT-licensed, needs Python 3.11 or later, and is documented at
Install
pip install prov
PROV-JSON, PROV-N and PROV-JSONLD need nothing else; PROV-XML, PROV-O and the graph tools each need an extra, listed on the installation page.
Quick start
import prov.model as pm
doc = pm.ProvDocument()
doc.set_default_namespace("https://example.org/")
doc.entity("report")
doc.activity("analysis")
doc.wasGeneratedBy("report", "analysis")
print(doc.get_provn())
doc.serialize("report.json")
document
default <https://example.org/>
entity(report)
activity(analysis, -, -)
wasGeneratedBy(report, analysis, -)
endDocument
The tutorial continues from here.
Features
- In-memory classes for every PROV-DM record type, readable from and printable as
- Serialization to and from PROV-N,
- Export to graphical formats such as PDF, PNG and SVG through Graphviz.
- Conversion to and from a NetworkX
MultiDiGraph. - PROV-N syntax highlighting through a Pygments lexer, with the
pygmentsextra. - Command-line tools,
prov-convertandprov-compare.