API reference

Serialize an object and write its environment manifest atomically.

Parameters:

Name Type Description Default
obj Any

Python object to persist.

required
path PathLike

Destination artifact path.

required
metadata Optional[Dict[str, Any]]

Optional JSON-compatible model metadata.

None
backend str

"auto", "pickle", or "joblib".

'auto'
include_git bool

Record the current Git commit and dirty state when available.

True
signing_key Optional[SigningKey]

Optional bytes-like HMAC secret.

None
key_id Optional[str]

Optional identifier stored and authenticated with the signature.

None

Returns:

Type Description
Manifest

The normalized manifest written beside the artifact.

Raises:

Type Description
TypeError

Metadata, signing key, or key identifier has an invalid type.

ValueError

An option is invalid or key_id lacks a signing key.

Verify, compatibility-check, then deserialize an artifact.

Parameters:

Name Type Description Default
path PathLike

Artifact to load.

required
on_mismatch str

"warn", "raise", or "ignore" for runtime compatibility differences.

'warn'
backend str

"auto", "pickle", or "joblib".

'auto'
return_manifest bool

Return (object, manifest) instead of only the object.

True
signing_key Optional[SigningKey]

Direct HMAC key for legacy or single-key deployments.

None
signing_keys Optional[Mapping[str, SigningKey]]

Registry mapping authenticated key IDs to HMAC keys.

None

Returns:

Type Description
Union[Any, Tuple[Any, Manifest]]

The deserialized object, optionally paired with its manifest.

Raises:

Type Description
ArtifactIntegrityError

Artifact or signature verification fails.

EnvironmentMismatchError

Runtime differences exist under "raise".

ManifestError

The sidecar is missing, malformed, or incompatible.

Verify an artifact without deserializing it.

Parameters:

Name Type Description Default
path PathLike

Artifact whose sidecar manifest should be verified.

required
signing_key Optional[SigningKey]

Direct HMAC key for legacy or single-key deployments.

None
signing_keys Optional[Mapping[str, SigningKey]]

Registry mapping authenticated key IDs to HMAC keys.

None

Raises:

Type Description
ArtifactIntegrityError

The artifact or signature does not match.

ManifestError

The sidecar is missing or malformed.

Check integrity and runtime compatibility without deserializing.

Parameters:

Name Type Description Default
path PathLike

Artifact to check.

required
signing_key Optional[SigningKey]

Direct HMAC key for legacy or single-key deployments.

None
signing_keys Optional[Mapping[str, SigningKey]]

Registry mapping authenticated key IDs to HMAC keys.

None

Returns:

Type Description
MismatchReport

A report whose truth value indicates a mismatch.

Raises:

Type Description
ManifestError

The sidecar is missing or malformed.

Read a sidecar manifest without verifying or deserializing the artifact.

Parameters:

Name Type Description Default
path PathLike

Artifact path used to locate the sidecar.

required

Returns:

Type Description
Manifest

The validated manifest.

Raises:

Type Description
ManifestError

The sidecar is missing or malformed.

Validated record describing a serialized model artifact.

signing_bytes()

Return a stable representation used by keyed manifest signatures.

Comparison of the saved runtime with the current runtime.