brain_deer.plugins_host.plugin_manager

BrainDeer 2.0 plugin discovery / instantiation.

The Qt UI expects:
  • discover_plugins() to return plugin ids

  • get_available_plugins() to list discovered ids

  • get_plugin_metadata(plugin_name) to return PluginMetadata for cards

  • instantiate_plugin(plugin_name, api_instance) to create & initialize a plugin

In 2.0 the previous implementation was a stub that returned no plugins, so the Atlas Browser / leadDBS plugins never appeared in the UI.

Classes

PluginManager

Discover and load plugins from brain_deer/plugins/<id>/plugin.py.

Functions

bundled_plugins_dir(→ pathlib.Path)

src/brain_deer/plugins — the first-party plugin tree.

Module Contents

brain_deer.plugins_host.plugin_manager.bundled_plugins_dir() → pathlib.Path

src/brain_deer/plugins — the first-party plugin tree.

class brain_deer.plugins_host.plugin_manager.PluginManager(plugin_dir: str)

Discover and load plugins from brain_deer/plugins/<id>/plugin.py.

discover_plugins() → List[str]

Return discovered plugin ids.

A plugin id is the directory name that contains a plugin.py file, e.g. brain_deer/plugins/vr_stream/plugin.py -> "vr_stream".

Discovery is limited to _BUNDLED_PLUGIN_ALLOWLIST so stray folders under plugins/ do not appear in the UI.

release_plugin(name: str) → None

Forget a plugin instance after the UI has torn it down.

Without this, instantiate_plugin() would return the cached instance on a later open in the same process: cleanup() has already deleted the widget and initialize() is not run again, so activation fails (e.g. Laminosaurus tab stays empty).

instantiate_plugin(name: str, api_instance: object) → brain_deer.plugin_api.v1.PluginBase | None

Instantiate and initialize a plugin for activation in the UI.

get_available_plugins() → List[str]

Return discovered plugin ids.

The current 2.0 implementation is a stub, but the Qt UI expects this method to exist.

get_plugin_metadata(plugin_name: str)

Return plugin metadata for UI cards.

Important: we probe metadata without executing plugin __init__ logic (some plugins may reference optional dependencies or setup resources).