Loader

Plugin loader for discovering and loading Arshai plugins.

Classes

class arshai.extensions.loader.PluginLoader(plugin_paths=None)[source]

Bases: object

Loader for discovering and loading plugins.

Plugins can be loaded from: - Python packages (installed via pip) - Local directories - Plugin manifest files

__init__(plugin_paths=None)[source]

Initialize the plugin loader.

Parameters:

plugin_paths (Optional[List[Path]]) – Additional paths to search for plugins

discover_plugins()[source]

Discover available plugins.

Return type:

List[PluginMetadata]

Returns:

List of plugin metadata for discovered plugins

load_plugin(name, config=None)[source]

Load a plugin by name.

Parameters:
  • name (str) – Name of the plugin to load

  • config (Optional[Dict[str, Any]]) – Configuration for the plugin

Return type:

Plugin

Returns:

Loaded plugin instance

load_from_manifest(manifest_path)[source]

Load plugins from a manifest file.

The manifest file can be JSON or YAML format: ```yaml plugins:

  • name: my_plugin config:

    api_key: secret

  • name: another_plugin

```

Parameters:

manifest_path (Path) – Path to the manifest file

Return type:

List[Plugin]

Returns:

List of loaded plugins

Functions

arshai.extensions.loader.get_plugin_loader()[source]

Get the global plugin loader.

Return type:

PluginLoader

arshai.extensions.loader.load_plugin(name, config=None)[source]

Convenience function to load a plugin.

Parameters:
Return type:

Plugin

Returns:

Loaded plugin instance