You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MolForge supports custom plugin actors. See `molforge/actor_plugins/example.py` for a complete, documented template.
508
+
MolForge supports custom plugin actors for extending the pipeline with domain-specific functionality. Plugins are automatically discovered and integrate seamlessly with the core framework.
509
509
510
-
### Creating a Plugin
510
+
### Quick Start
511
511
512
-
1. Create parameter class inheriting from `BaseParams`
Custom actors are placed in `molforge/actor_plugins/` and automatically loaded at runtime. Each plugin consists of a parameter class and an actor class:
516
513
517
-
See the example plugin for detailed guidance on parameter validation, error handling, and pipeline integration.
514
+
```python
515
+
from dataclasses import dataclass
516
+
from molforge.actors.base import BaseActor
517
+
from molforge.actors.params.base import BaseParams
518
+
519
+
@dataclass
520
+
classMyPluginParams(BaseParams):
521
+
my_parameter: str='default_value'
522
+
523
+
classMyPlugin(BaseActor):
524
+
__step_name__ ='my_plugin'# Used in pipeline configuration
525
+
__param_class__ = MyPluginParams
526
+
527
+
defprocess(self, data):
528
+
# Your processing logic here
529
+
return data
530
+
```
531
+
532
+
### Using Plugins in Pipelines
533
+
534
+
Reference plugins by their `__step_name__` in the pipeline steps, and configure them using `plugin_params`:
535
+
536
+
```python
537
+
from molforge import MolForge, ForgeParams
538
+
539
+
params = ForgeParams(
540
+
steps=['source', 'chembl', 'curate', 'my_plugin'], # Add plugin to steps
541
+
plugin_params={
542
+
'my_plugin': MyPluginParams(
543
+
my_parameter='custom_value'
544
+
)
545
+
}
546
+
)
547
+
548
+
forge = MolForge(params)
549
+
df = forge.forge("CHEMBL234")
550
+
```
551
+
552
+
### Common Patterns
553
+
554
+
#### Input and Output Specification
555
+
556
+
Declare required input columns and output columns for pipeline validation:
557
+
558
+
```python
559
+
classMyPlugin(BaseActor):
560
+
@property
561
+
defrequired_columns(self):
562
+
return ['curated_smiles'] # Columns needed from previous actors
563
+
564
+
@property
565
+
defoutput_columns(self):
566
+
return ['my_property'] # Columns added by this actor
567
+
```
568
+
569
+
#### Handling Optional Dependencies
570
+
571
+
Use graceful error handling for optional dependencies:
0 commit comments