plugins.spec.PluginSpec

plugins.spec.PluginSpec(
    name,
    kind,
    transport=PluginTransport.LOCAL,
    api_path=None,
    image=None,
    url=None,
    object=None,
    options=dict(),
    version=None,
    schema_hash=None,
)

Which Tesseract.from_* call stands behind one plugin name.

Attributes

Name Type Description
name str The registry key, e.g. "thermal_jaxfem".
kind str The slot it fills, e.g. "thermal_solver". A plain string, not an enum: a third-party plugin may declare a kind cadjoint has never heard of (the ones it asks for itself are :class:cadjoint.enums.PluginKind).
transport PluginTransportLike A :class:~cadjoint.enums.PluginTransport or its plain string spelling; normalised to the enum on construction.
api_path Path | None local — the package’s tesseract_api.py.
image str | None container — the Docker image reference.
url str | None remote — the base URL of a served Tesseract.
object str | None python"module:attribute" naming an importable object that satisfies the kind’s contract (:mod:cadjoint.plugins.contracts). A dotted attribute path ("pkg.mod:NAMESPACE.component") is followed.
options Mapping[str, Any] Keyword arguments passed straight to the constructor (timeout, environment, volumes, num_workers, … — whatever the installed tesseract-core accepts). Unused by the python transport.
version str | None The version the package’s tesseract_config.yaml declares. Advisory; the authority is :meth:Plugin.probe.
schema_hash str | None The expected sha256:... of the served schema. When set, :meth:Plugin.probe refuses an instance that does not match — the staleness fence for a long-lived remote.

Methods

Name Description
at A copy of this spec with changes applied (e.g. a new url).
from_mapping Build a spec from a plugins.toml table or an entry point.
open Make the Tesseract.from_* call this spec names, or the import.
to_mapping The spec as a plugins.toml table.

at

plugins.spec.PluginSpec.at(**changes)

A copy of this spec with changes applied (e.g. a new url).

from_mapping

plugins.spec.PluginSpec.from_mapping(name, data)

Build a spec from a plugins.toml table or an entry point.

Parameters

Name Type Description Default
name str The registry key (the table name). required
data Mapping[str, Any] The table’s contents. required

Returns

Name Type Description
PluginSpec The spec, with ${VAR} references expanded.

Raises

Name Type Description
PluginConfigError On an unknown key, a missing kind, or a transport whose target is absent.

open

plugins.spec.PluginSpec.open()

Make the Tesseract.from_* call this spec names, or the import.

Returns

Name Type Description
component Any The tesseract_core.Tesseract, or for the python transport the imported object.
spawned bool Whether this call started a container the caller must tear down.

Raises

Name Type Description
ImportError Without the tesseract extra (Tesseract transports), or when a python spec’s module is absent.
PluginConfigError If a local spec’s api_path is absent, or a python spec’s object is malformed or missing.

to_mapping

plugins.spec.PluginSpec.to_mapping()

The spec as a plugins.toml table.