-
Notifications
You must be signed in to change notification settings - Fork 0
15_Dynamic_Plugin_Internals
BioPro CI Bot edited this page May 16, 2026
·
1 revision
BioPro's extensibility comes from its ability to discover, verify, and "hot-reload" Python packages at runtime. The ModuleManager acts as the gatekeeper for all third-party code.
BioPro looks for plugins in two distinct locations:
-
Internal Directory: Modules bundled with the application (e.g., in
BioPro.app/Contents/Resources/biopro/plugins). -
User Directory: Modules installed by the user (typically in
~/.biopro/plugins).
To make importing easy, BioPro dynamically merges these two folders into a single virtual Python namespace. This allows a plugin in your home folder to be imported as if it were part of the core package:
# Both internal and user-installed plugins are found here:
import biopro.plugins.my_cool_moduleWhen you click an Analysis Module in the Hub, BioPro triggers the Loader Pipeline:
-
Manifest Verification: The
ModuleManagerreads themanifest.jsonand ensures it satisfies the core version requirements. -
Security Handover: The
TrustManagerverifies the plugin's signature and file integrity (see Security & Trust). -
Dynamic Import: The
importliblibrary loads the package into Python's memory. -
Contract Enforcement: BioPro checks if the module satisfies the BioProPlugin Interface Contract (i.e., it has
__version__,__plugin_id__, andget_panel_class()). -
UI Injection: The main widget class is returned to the
WorkspaceWindowand parented into the layout.
Unlike many legacy tools, BioPro doesn't require a restart when you install or update a plugin.
When the Nervous System (Event Bus) emits a PLUGIN_INSTALLED event:
-
ModuleManagerclears its internal cache. - It uses
importlib.reloadlogic to purge the old code from Python'ssys.modules. - It rescans the disk for the new version.
- The UI is updated instantly to reflect the change.
Initializes the discovery engine and sets up the user-plugins namespace.
-
get_available_modules(): Returns a list of all verified plugin manifests. -
load_module_ui(module_id): The "High-Risk" method. Performs security checks and imports the UI class into RAM. -
reload_modules(): Flushes the Python module cache and rescans the disk. -
trust_module(module_id): Upgrades an "Untrusted" module to "Personally Trusted" by snapshotting its current file hashes.