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 https://prov.readthedocs.io/.
pip install provPROV-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.
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.
- In-memory classes for every PROV-DM record type, readable from and printable as PROV-N.
- Serialization to and from PROV-N, PROV-JSON, PROV-JSONLD, PROV-XML and PROV-O (RDF).
- Export to graphical formats such as PDF, PNG and SVG through Graphviz.
- Conversion to and from a NetworkX
MultiDiGraph. - Command-line tools,
prov-convertandprov-compare.
Over 7,000 public repositories on GitHub depend on this package. What's new in 3 summarises the 3.x line, and the announcement post explains the move. ROADMAP.md lists the planned releases, SECURITY.md the supported versions, and the issue tracker takes feedback.