elasticai.creator.plugin.plugin_spec#

Module Contents#

Classes#

PluginSpec

The specification of a plugin.

Functions#

build_plugin_spec

inspect spec_type and build an instance of it from the dictionary d.

API#

class elasticai.creator.plugin.plugin_spec.PluginSpec[source]#

The specification of a plugin.

Typically built by reading a dictionary from a toml file and building the spec using <<build_plugin_spec, build_plugin_spec()>>. The dataclass is only used to provide convenient access to the fields, support type checking and improve code readability.

You can achieve your goals just as well with the PluginDict dictionary. That is defined as an alias for dict[str, str | tuple[str, ...]].

name: str#

None

target_platform: str#

None

target_runtime: str#

None

version: str#

None

api_version: str#

None

package: str#

None

elasticai.creator.plugin.plugin_spec.build_plugin_spec(d: elasticai.creator.plugin.plugin_spec.PluginMap, spec_type: type[elasticai.creator.plugin.plugin_spec.build_plugin_spec.SpecT]) elasticai.creator.plugin.plugin_spec.build_plugin_spec.SpecT[source]#

inspect spec_type and build an instance of it from the dictionary d.

Missing field raise an error while extra fields will be ignored.

exception elasticai.creator.plugin.plugin_spec.MissingFieldError(field_names: set[str], plugin_type: type[PluginSpecT])[source]#

Bases: Exception