Repository navigation
3.0.0
3.0.0 is the compatibility release: the one release the roadmap allows to change behaviour and drop dependencies, closing out the standards-conformance work (PROV-DM, PROV-CONSTRAINTS, PROV-O) that a backward-compatible 2.x series could not fix. See Upgrading to 3.0 for what changed and what to do about it.
Breaking changes
ProvBundle.unified()/ProvDocument.unified()implement PROV-CONSTRAINTS key constraints (22/23) with pairwise term unification of formal attributes: records sharing an identifier whose formal attributes hold different concrete values now raise the new documentedprov.model.ProvUnificationErrorinstead of silently unioning; absent formal attributes unify with concrete values; extra attributes keep set-union semantics; bundles unify independently (#253)unified()rejects same-identifier records of incompatible types (entity vs activity, distinct relation kinds — PROV-CONSTRAINTS 53/54/55) withProvUnificationErrorinstead of merging them order-dependently into the first record's type; spec-permitted overlaps (an agent that is also an entity or activity) are kept as separate records (#253)- Attribute values that are Python-equal but differently typed (
2vs2.0,1vsTrue) are all retained on a record instead of collapsing to whichever was asserted first — visible in attribute iteration, record equality and hashing, and serialization. Attributes now iterate in assertion order rather than an arbitrary hash order, which makesargs,formal_attributes,get_startTime()andget_endTime()deterministic.ProvRecord.get_attribute(),get_asserted_types()and thevalueproperty still return a plainset, but it is now built fresh on every call, so mutating it no longer writes through to the record:record.get_asserted_types().add(qn)now silently does nothing (#34) pydotandnetworkxare no longer unconditional runtime dependencies.import prov.dotnow requires thedotextra (pip install "prov[dot]") andimport prov.graphthegraphextra; without them the import raisesModuleNotFoundErrornaming the extra to install. Theplotextra now pulls inpydot/networkxas well, sinceplot()renders throughprov.dot. See the upgrading guide.- The
rdfextra now requiresrdflib>=7.0.0(previously>=6.0.0); round-trip behaviour is unchanged python-dateutildropped —provnow has no unconditional runtime dependencies. Datetime strings are parsed asxsd:dateTime(ISO 8601 plus the hour-24 end-of-day form) via the standard library; factorytime=/startTime=/endTime=parameters raiseProvExceptionon invalid input instead of leaking a raw dateutil error, and non-ISO forms previously tolerated by dateutil (e.g."Nov 7, 2011") are no longer accepted (#237)- The misspelled
prov.model.GenrationReftype alias is renamedGenerationRef; the old spelling is removed rather than kept as a deprecated alias
Conformance and correctness fixes
- When an attribute is asserted twice with an equal value of equal type — e.g.
Literal("10", XSD_DECIMAL)andLiteral("10.00", XSD_DECIMAL)(#77), orLiteral("hi", langtag="en")andLiteral("hi", langtag="EN")(#259) — the record retains the first value asserted, as in 2.x (#34) - Numeric datatype fidelity:
Literalvalues typedxsd:long(and the rest of the XSD integer family) keep their asserted datatype instead of being silently re-typedxsd:int(#235); PROV-N output types plain integers by magnitude (xsd:int/xsd:long/xsd:integer) so out-of-int32 values are no longer emitted as invalid bare int literals (#249), and plain floats as full-precisionxsd:doubleinstead of%g-truncatedxsd:float(#251) - Literal semantics: string literals have one canonical serialized form (RDF output no longer decorates plain strings with
^^xsd:string) (#89);xsd:decimalliterals compare and hash in value space (#77); language tags compare case-insensitively per RDF 1.1 while preserving their original case in output (#259) - PROV-XML round trip preserves attributes whose value is the empty string; previously they were silently dropped on deserialization (#224)
- PROV-XML serializes attribute names containing characters illegal in an XML NCName using the reversible
_xHHHH_escaping convention instead of raisingValueError; the deserializer applies the inverse, so such names round-trip (#289) - The PROV-JSON deserializer raises
ProvJSONExceptionon structurally malformed input instead of leaking rawKeyError/AttributeError(#228) - PROV-JSON typed literals always encode
$as a string, and plain integers are typed by magnitude across PROV-JSON/PROV-XML/PROV-O output (xsd:int/xsd:long/xsd:integer), fixing schema-invalid output for out-of-int32 values (#244, #246, #256) - PROV-JSON encodes QualifiedName attribute values as
xsd:QNametyped literals per the PROV-JSON submission (previously the non-standardprov:QUALIFIED_NAME, which remains accepted on input) (#168), andprov:QUALIFIED_NAME-typedLiteralvalues are resolved to QualifiedNames at assertion time, restoring round-trip equality (#238) - PROV-O: documents containing multiple same-identifier relations with differing formal attributes ("scruffy" statements) are documented as a PROV-O representational limitation — they serialize but do not round-trip through RDF, and deserializing such RDF now raises an error naming the limitation; all other formats are unaffected (#217)
- PROV-O: a related gap is recorded, not fixed — an attribute key whose local part ends in a PROV-N metacharacter (#223) can fail to round-trip through RDF when its namespace has not already been registered by another qualified name;
docs/reference/conformance.mddocuments it as an open defect (#341) - PROV-O (RDF) round-trip fidelity: mixed XSD-datatype attribute sets survive deserialization with their asserted datatypes intact (#218), and
xsd:doublevalues are emitted at full precision instead of rdflib's 6-significant-digit canonical form (#225) - PROV-O output: anonymous qualified Communication/Attribution/Delegation/Influence nodes now carry their influencer property (
prov:activity/prov:agent/prov:agent/prov:influencer) as the PROV-O qualification tables require, and the RDF round trip no longer collapses distinct anonymous delegations sharing a (delegate, activity) pair (#250, #226) - PROV-O output emits
alternateOfwith the PROV-DM argument order (alt1 prov:alternateOf alt2); previously subject and object were transposed on both write and read (#258) - PROV-O (RDF) deserialization returns
xsd:base64Binaryliterals as their base64 text; previously the value was wrapped in a Python bytes repr (b'…'), corrupting the round trip (#288) - PROV-O (RDF) deserialization reconciles
prov:startedAtTime/prov:endedAtTimeasserted directly on a qualifiedprov:Start/prov:Endnode into the relation's formalprov:timeattribute; previously the formal attribute was leftNoneand the value misfiled as an extra attribute (#299) - PROV-O (RDF) round trip: an anonymous Communication/Attribution/Influence relation carrying extra attributes now deserializes back into a single record instead of two (#303)
- PROV-O (RDF) round trip: a qualified name whose local part ends in a PROV-N metacharacter (
= ' , : ; [ ]) now deserializes instead of raisingValueError: Can't split ...; serialized output is unchanged (#294) - PROV-N output escapes qualified-name local parts per the grammar's
PN_CHARS_ESCproduction, so identifiers containing' ( ) , : ; [ ] =no longer produce invalid PROV-N (#223) - PROV-N continues to emit Mention as bare
mentionOf(...)— the de-facto syntax of the reference implementations for the last decade — rather than theprov:mentionOfform derivable from the PROV-Links note; now documented as a deliberate deviation (#248)
Improvements
- Bundle-local and default namespace prefixes are now bound into RDF serialization alongside document-level ones, so turtle/TriG output uses the declared prefixes instead of auto-minted
ns1:-style fallbacks (#96) - Security: PROV-XML parsing no longer resolves DTD entities and never touches the network (
resolve_entities=False,no_network=True), closing an XXE surface on untrusted input (#273) - New public type aliases in
prov.model, joining the existingNameValuePair:AttributePair(an attribute name/value pair before qualified-name resolution),InfluencerRef(theinfluencerparameter ofwasInfluencedBy()andinfluence()) andStreamOrPath(the source and destination parameters ofread(),serialize()anddeserialize())
Internal
- The PROV-O (RDF) serializer's encode/decode container functions were decomposed into per-record-type dispatch, with byte-identical output (#274)
- Functions across the model, the serializers and
prov.dotwere refactored below the project's complexity threshold, with byte-identical behaviour (#275) - Code-quality passes across
src/prov/— type-alias adoption, removal of a permanently-disabled branch in the PROV-O (RDF) encoder, and readability clean-ups — with no change in behaviour - Test infrastructure: the RDF fixture-comparison helper
find_diff()now detects single-triple differences, which it previously missed (#304)