-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Asterios Raptis edited this page Mar 27, 2026
·
1 revision
pip install pluginforgeWith optional dependencies:
pip install pluginforge[fastapi] # FastAPI route mounting
pip install pluginforge[alembic] # Alembic migration support# config/app.yaml
app:
name: "MyApp"
version: "1.0.0"
default_language: "en"
plugins:
entry_point_group: "myapp.plugins"
enabled:
- "hello"# plugins/hello_plugin.py
from pluginforge import BasePlugin
class HelloPlugin(BasePlugin):
name = "hello"
version = "0.1.0"
description = "A simple greeting plugin"
author = "Your Name"
def activate(self) -> None:
greeting = self.config.get("greeting", "Hello")
print(f"{greeting} from {self.name}!")
def deactivate(self) -> None:
print(f"Goodbye from {self.name}!")# config/plugins/hello.yaml
greeting: "Hallo"
max_greetings: 5from pluginforge import PluginManager
pm = PluginManager("config/app.yaml")
# Option A: Discover plugins via entry points
pm.discover_plugins()
# Option B: Register plugin classes directly
from plugins.hello_plugin import HelloPlugin
pm.register_plugins([HelloPlugin])
# Use plugins
active = pm.get_active_plugins()
print(f"Active plugins: {[p.name for p in active]}")
# Shutdown
pm.deactivate_all()A typical project using PluginForge:
myapp/
├── config/
│ ├── app.yaml # Main app config
│ ├── plugins/
│ │ ├── hello.yaml # Per-plugin config
│ │ └── export.yaml
│ └── i18n/
│ ├── en.yaml # English strings
│ └── de.yaml # German strings
├── plugins/
│ ├── hello_plugin.py
│ └── export_plugin.py
└── app.py # Application entry point
- BasePlugin - All plugin attributes and lifecycle methods
- Configuration - Deep dive into the YAML config system
- Hooks - How to define and implement pluggy hooks