molforge.plugins¶
plugins ¶
Plugin registry and discovery.
Third-party packages can register additional engines, parsers, or scoring
functions by exposing entry points under the molforge.plugins group:
.. code-block:: toml
[project.entry-points."molforge.plugins"]
my_docker = "my_pkg:register"
The function pointed to by the entry point should call
:func:register_engine, :func:register_parser, or :func:register_scorer
to make its capability available.
available ¶
List registered plugin names, optionally filtered by kind.
discover ¶
Discover and load plugins exposed via the molforge.plugins entry-point group.
Each entry point should be a callable taking no arguments; it is
expected to perform its own registration via the register_*
functions exported from this module.
Returns:
| Type | Description |
|---|---|
list[str]
|
A list of entry-point names that were successfully loaded. If a |
list[str]
|
plugin fails to import or its registration function raises, the |
list[str]
|
exception is suppressed and the name is omitted from the |
list[str]
|
returned list. (We deliberately don't propagate exceptions |
list[str]
|
because one broken plugin shouldn't be able to break every |
list[str]
|
downstream user of molforge.) |
Example¶
A third-party plugin declared in its own pyproject.toml::
[project.entry-points."molforge.plugins"]
my_docker = "my_pkg.molforge_integration:register"
where my_pkg.molforge_integration:register is a callable that
calls :func:register_engine (or :func:register_parser /
:func:register_scorer) one or more times.
From a user's code::
from molforge.plugins import discover, get
loaded = discover()
# loaded == ["my_docker"]
engine = get("engine", "my_docker_engine")()
register_engine ¶
Register a docking / folding / MD engine factory by name.
register_parser ¶
Register a file-format parser by name (typically the extension).
register_scorer ¶
Register a scoring function by name.