Repository navigation
3.3.0 is a minor release that rejects the input 3.2.3 warned about with ProvFutureRejectionWarning, requires Python 3.11, and adds a Pygments lexer for PROV-N and new command-line options. Code that reads PROV it did not write, catches a reader's errors or compares literals may need changes, and Upgrading to prov 3.3.0 gives each case. It also fixes GHSA-pp6h-3q6w-xr98 in the PROV-O reader, which 2.5.4 fixes on the 2.x line. Against 3.2.3 on the benchmark suite, most operations are faster by up to 30%, but the PROV-JSON and PROV-JSONLD reads are 7% to 11% slower, mostly because each attribute value gets its comparison key when it is asserted, and prov_to_graph() is 27% to 38% slower because it now includes the records inside bundles.
These changes need action:
- Install on Python 3.11 or later
- Catch
prov.serializers.ProvSerializationError, orprov.Error, around a read (Exceptions) - Correct the input that raised
ProvFutureRejectionWarningin 3.2.3, because it now raises an error (Read the message) - Index the list that
get_records()with a class returns, where 3.2.3 returned an iterator (get_records())
Breaking changes
3.3.0 rejects the input that 3.2.3 warned about with a ProvFutureRejectionWarning, and a further set of ill-formed inputs, and reads a few inputs differently. Upgrading to prov 3.3.0 lists each message, the input that causes it and what to write instead.
provrequires Python 3.11 or later, since Python 3.10 reached its end of life on 2026-10-31 (#604)- A reader raises its format's error, a
ProvSerializationError, for a model rejection too, where 3.2.3 raised the model's error, or a bareValueErrororAttributeError. Writeexcept ProvSerializationErroraround a read, orexcept prov.Errorfor both kinds (#653) - A
Literalofxsd:boolean,xsd:decimal,xsd:double,xsd:floator an integer type compares by its value, soLiteral("05", XSD_INT) == Literal("5", XSD_INT), and keeps a non-canonical text such as"05"as written, where 3.2.3 compared every type butxsd:decimalby its text (#527) - A record without an identifier no longer equals one with an identifier, and two documents are equal only when they hold the same bundles, where 3.2.3 found each pair equal from one side.
hash()agrees with==, andprov-compareexits by the same rule (#525) unified()keeps each record once and drops a record equal to an earlier one, so two equal anonymoususedstatements become one andprov_to_graph()andprov_to_dot()draw one edge, where 3.2.3 kept both (#548)get_records()with a class or a tuple of classes returns a list, so writenext(iter(...))to take the first record, where 3.2.3 returned a one-shot iterator (#491)- A bundle declares only the namespaces it binds itself, so a document read from PROV-JSON, PROV-JSONLD or PROV-XML no longer writes the document's
prefix exagain inside each bundle that uses it, andbundle.get_registered_namespaces()lists the bundle's own declarations only (#449) - The PROV-N writer wraps a statement with an attribute block wider than 80 columns, one attribute per row, where 3.2.3 wrote one line. Pass
width=Nonefor one line, and give aget_provn()override awidthparameter (#131) - A record holds one value of each PROV attribute, so assert one
hadMemberper entity, where 3.2.3 accepted several in one call. The PROV-XML reader reads ahadMemberwith several entities as one record per entity (#700) - A
hadMember,alternateOf,specializationOformentionOfmissing either party raisesProvMissingFormalAttribute, so assert both, and every reader skips such a statement with aProvWarning, where 3.2.3 built the record (#710) - A
Literalwhose datatype is not aQualifiedNameorNoneraisesProvValueErrorwhen it is built or unpickled, so pass the resolved name, where 3.2.3 accepted any object (#705) prov_to_graph()flattens the document before it unifies it, so the records inside bundles become nodes and edges, where 3.2.3 drew the top-level records only. Pass it a document, not a bundle. Bundles that disagree about a shared identifier raiseProvUnificationError(#651)prov-convertwrites an output file whose extension names a format, such asout.xml, in that format, where 3.2.3 wrote PROV-JSON. Errors print one line, Ctrl-C exits 130, and-Vprints the program name and version (#737)- The PROV-O reader raises
ProvRDFExceptionfor an IRI typed as both an element and a relation, such as an element whoseprov:typenames a relation class, where 3.2.3 raised a bareStopIteration, lost a record or read the element (#743) - The PROV-O reader raises
ProvRDFExceptionfor a relation that repeats a formal attribute, so write one relation per value, where 3.2.3 read one record per combination of the values, without a warning (GHSA-pp6h-3q6w-xr98)
New features
- A Pygments lexer for PROV-N, registered as
provnandprov-n, letspygmentize, Sphinx, MkDocs and other Pygments-based tools highlight aprovncode block. Thepygmentsextra installs Pygments (#628) prov-convertandprov-comparegain four features.- Both detect the input format from the file's extension or else its content, so a format flag is needed only to override it (#737)
prov-convert -wand-r, andprov-compare -rand-R, passNAME=VALUEoptions to a format's writer or reader (#667)prov-convert --colorhighlights the output with Pygments, which thepygmentsextra installs (#684)- Both have reference pages, and each GitHub release attaches their man pages (#83)
Fixes
- The PROV-O, PROV-JSON and PROV-JSONLD readers register a default binding, such as Turtle's
@prefix :, as the document's default namespace, where 3.2.3 wrote it as a nameless PROV-Nprefix. The PROV-O reader no longer declares rdflib's own bindings (#654) - A
Literalwhose datatype is in a namespace nothing declared registers that namespace when it is asserted, so every writer declares it, where 3.2.3 wrote"1" %% zz:twith noprefix zz(#615) - The PROV-N reader parses an extensibility expression,
prefix:name(...), under every profile and drops it with oneProvWarning, where thestrictanddefaultprofiles of 3.2.3 raised. A stray{or}is a parse error thatlenientskips (#520) prov_to_dot()andplot()withuse_labels=Truedraw an element that has noprov:labelwith its identifier once, where 3.2.3 drew it twice (#695)- A refused
ProvDocument.add_bundle()leaves the bundle's identifier and namespaces as they were, where 3.2.3 could set the identifier and leave the bundle's namespaces linked to the document (#726) prov-convertreads its input before it opens the output file, so an input that fails to parse leaves an existing output file as it was, where 3.2.3 emptied it (#742)- The PROV-JSONLD writer writes a qualified name under an attribute other than
prov:type,prov:locationandprov:roleas a node reference,{"@id": "ex:x"}, where 3.2.3 wrote anxsd:QNamevalue object.prov3.2.2 and earlier cannot read the new form (#564) - PROV-N writes an
xsd:QNameliteral value as'ex:x'and PROV-O writes the IRI, where 3.2.3 wrote"ex:x" %% xsd:QNameand"ex:x"^^xsd:QName(#238)
The 3.3.0 milestone lists every fixed issue.
Project
- The wheel no longer holds
prov.testsand its fixtures, which ship in the sdist (#728) - These warn
DeprecationWarning, and 4.0 removes them:ProvBundle.unified(). Unify the document withProvDocument.unified()instead (#652)prov_to_dot()andplot()given a bundle that is not a document, because 4.0 draws documents only (#652)ProvBundle.documentand thedocumentargument ofProvBundle(). Keep a reference to the document and create a bundle withProvDocument.bundle()(#650)ProvRecord.bundle. Keep the document or bundle that made the record beside it (#734)
Identifier,QualifiedName,NamespaceandLiteralraiseAttributeErrorwhen code assigns or deletes a stored field such as_valueafter construction, so a subclass that set one in its own__init__now calls the base class's__init__, where 3.2.3 let the change through (#444)sorted_attributesis no longer public API and stays importable (#742)