elasticai.creator.plugin#

Package Contents#

Classes#

PluginLoaderBase

PluginLoader for Ir2Verilog passes.

StaticFileBase

PluginSpec

The specification of a plugin.

Functions#

build_plugin_spec

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

import_symbols

import names from a module and yield the resulting objects.

read_plugin_dicts_from_package

read the meta.toml file from the package returning the list of plugin dictionaries.

API#

elasticai.creator.plugin.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.

elasticai.creator.plugin.import_symbols(module: str, names: collections.abc.Iterable[str]) collections.abc.Iterator[Any][source]#

import names from a module and yield the resulting objects.

elasticai.creator.plugin.read_plugin_dicts_from_package(package: str) collections.abc.Iterable[elasticai.creator.plugin.plugin_spec.PluginMap][source]#

read the meta.toml file from the package returning the list of plugin dictionaries.

class elasticai.creator.plugin.PluginLoaderBase(spec: type[PS])[source]#

PluginLoader for Ir2Verilog passes.

Initialization

load_from_package(package: str) None[source]#
abstractmethod filter_plugin_dicts(plugins: collections.abc.Iterable[dict[str, Any]]) collections.abc.Iterable[dict[str, Any]][source]#
abstractmethod load_symbol(symbol: S) None[source]#
abstractmethod get_symbols(specs: collections.abc.Iterable[PS]) collections.abc.Iterable[S][source]#
get_specs(package) collections.abc.Iterable[PS][source]#
class elasticai.creator.plugin.StaticFileBase(name: str, package: str, subfolder: str)[source]#

Initialization

property name: str#
get_content() str[source]#
class elasticai.creator.plugin.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

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

Bases: Exception