Skip to main content

Module loader

Module loader 

Source
Expand description

Load a Python plugin package and produce a PythonPluginHandle whose method-index map lets the host dispatch by index just like the cdylib path.

Loading steps:

  1. Read the package’s package.toml and assert runtime = "python".
  2. Prepend <dir>/vendor and <dir> to sys.path (idempotent — repeated loads of the same package don’t insert twice).
  3. Import the entry module declared in [python].entry_module.
  4. Validate the module’s __interface_hash__ constant against the descriptor passed by the host. Mismatch = clean load error.
  5. Look up each method by name (in the descriptor’s order) so vtable indices resolve to Python callables at call time.

What we don’t do here: subprocess spawning, venv creation, or cancellation. All Python work happens in the host’s embedded interpreter (T-0085).

Enums§

PythonLoadError
Errors that can happen during Python plugin load.

Functions§

load_python_plugin
Load a Python plugin package against a static interface descriptor.
load_python_plugin_configured
Load a configured Python plugin instance (FIDIUS-A-0006 / CI.4): import the module, call its module-level __fidius_configure__(config) -> instance with the deserialized config, and bind methods on the returned instance — so the config is bound once and N differently-configured instances coexist (each is a distinct object). The module must export __fidius_configure__.