cellmap_flow.utils.plugin_manager

Plugin manager for cellmap_flow.

Handles registration, loading, and management of user plugins (ModelConfig, InputNormalizer, PostProcessor subclasses).

Plugins are stored in ~/.cellmap_flow/plugins/ and loaded automatically at startup so that custom subclasses appear in __subclasses__() calls.

Attributes

logger

PLUGINS_DIR

Functions

get_plugins_dir(→ pathlib.Path)

Return the plugins directory, creating it if necessary.

register_plugin(→ pathlib.Path)

Register a plugin by copying a Python file to ~/.cellmap_flow/plugins/.

unregister_plugin(→ None)

Remove a registered plugin by filename.

list_plugins(→ List[pathlib.Path])

Return a sorted list of all registered plugin file paths.

load_plugins(→ int)

Load all registered plugins from ~/.cellmap_flow/plugins/.

Module Contents

cellmap_flow.utils.plugin_manager.logger
cellmap_flow.utils.plugin_manager.PLUGINS_DIR
cellmap_flow.utils.plugin_manager.get_plugins_dir() pathlib.Path

Return the plugins directory, creating it if necessary.

cellmap_flow.utils.plugin_manager.register_plugin(filepath: str, force: bool = False) pathlib.Path

Register a plugin by copying a Python file to ~/.cellmap_flow/plugins/.

Parameters:
  • filepath – Path to the Python file to register.

  • force – Overwrite existing plugin with the same name.

Returns:

Path to the installed plugin file.

Raises:
  • FileNotFoundError – If the source file does not exist.

  • FileExistsError – If a plugin with the same name already exists and force is False.

  • ValueError – If the file is not a .py file or fails safety analysis.

cellmap_flow.utils.plugin_manager.unregister_plugin(name: str) None

Remove a registered plugin by filename.

Parameters:

name – Filename of the plugin (e.g. ‘my_normalizer.py’). The .py extension is added automatically if missing.

cellmap_flow.utils.plugin_manager.list_plugins() List[pathlib.Path]

Return a sorted list of all registered plugin file paths.

cellmap_flow.utils.plugin_manager.load_plugins() int

Load all registered plugins from ~/.cellmap_flow/plugins/.

Each plugin file is executed so that any subclasses defined in it (ModelConfig, InputNormalizer, PostProcessor) become available through __subclasses__().

Safe to call multiple times — plugins are only loaded once.

Returns:

Number of plugins successfully loaded.