makeprov.refs
Functions
|
Add dunder methods based on the fields defined in the class. |
|
Return an object to identify dataclass fields. |
|
Return a new object replacing specified fields with new values. |
Classes
|
Special type indicating an unconstrained type. |
|
A reference to an entity a run consumed or produced. |
|
PurePath subclass that can make system calls. |
|
The year, month and day arguments are required. |
|
Fixed offset from UTC implementation of tzinfo. |
- class makeprov.refs.ArtifactRef(id=None, path=None, types=('prov:Entity', ), digest=None, media_type=None, extent=None, modified=None, label=None, extra=<factory>)
Bases:
objectA reference to an entity a run consumed or produced.
A ref is either local or external:
local (
pathset): makeprov reads size, media type, mtime and a SHA-256 digest off the filesystem viaresolve().external (
idset, nopath): makeprov records the IRI and whatever metadata the caller supplied, and never touches the filesystem.
External refs are how a run cites a dataset, object-store key, model checkpoint or database snapshot by stable IRI without makeprov copying that resource’s own metadata into the provenance document.
Examples
ArtifactRef.local("results/model.pkl") ArtifactRef.external( "https://example.org/datasets/train-v17", types=("prov:Entity", "schema:Dataset"), digest="sha256:...", )
- classmethod external(id, *, types=('prov:Entity',), digest=None, media_type=None, extent=None, label=None, extra=None)
Reference an entity by IRI without touching the filesystem.
- Return type:
- classmethod local(path, *, types=('prov:Entity',), label=None, extra=None)
Reference a file on disk. Metadata is read lazily by
resolve().- Return type:
- resolve()
Return a copy with filesystem metadata populated.
External refs are returned unchanged. Local refs are stat-ed and hashed.
- Raises:
FileNotFoundError – If this is a local ref and the path is missing. Callers decide the policy for that; this method does not guess.
- Return type: