plugins.PluginSpec
plugins.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 |
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
| 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.PluginSpec.at(**changes)
A copy of this spec with changes applied (e.g. a new url).
from_mapping
plugins.PluginSpec.from_mapping(name, data)
Build a spec from a plugins.toml table or an entry point.
Parameters
| name |
str |
The registry key (the table name). |
required |
| data |
Mapping[str, Any] |
The table’s contents. |
required |
Returns
|
PluginSpec |
The spec, with ${VAR} references expanded. |
Raises
|
PluginConfigError |
On an unknown key, a missing kind, or a transport whose target is absent. |
open
plugins.PluginSpec.open()
Make the Tesseract.from_* call this spec names, or the import.
Returns
| 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
|
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.PluginSpec.to_mapping()
The spec as a plugins.toml table.