Plugin System
Extend EVOID with engines, adapters, and processors.
Plugin Registry
Every infrastructure component is a plugin:
from evoid.engines.plugin import register, resolve, list_plugins
# Register a custom plugin
register(
name="redis-cache",
type="engine",
factory=redis_cache_factory,
version="1.0.0",
description="Redis cache engine",
)
# Resolve it later
factory = resolve("redis-cache", "engine")
cache = factory()
# List all plugins
plugins = list_plugins()
for p in plugins:
print(f"{p.name} [{p.type}] v{p.version}")
Plugin Manifest
Every EVOID plugin on PyPI has a manifest: a Python dict in __init__.py.
# evoid_redis/__init__.py
MANIFEST = {
"name": "evoid-redis",
"version": "0.1.2",
"type": "engine",
"description": "Redis cache engine for EVOID",
"category": "cache",
"dependencies": ["redis>=4.0.0"],
"evoid_version": ">=0.4.0",
}
Installing Plugins
# Search for plugins
evo plug search cache
# Install a plugin
evo plug install evoid-redis
# List installed
evo plug list
# Now the pipeline can use storage:
# validate → authorize → store_order → handler
# Sandy didn't write database code. The plugin handles it.
```
Writing a Plugin
# my_plugin/__init__.py
from typing import Any
from evoid.engines.plugin import register
class MyStorage:
def __init__(self, path: str = "data.db"):
self.path = path
async def write(self, key: str, data: dict[str, Any], **kwargs) -> bool:
print(f"Stored {key} in {self.path}")
return True
async def read(self, key: str, **kwargs) -> Any | None:
return None
async def delete(self, key: str, **kwargs) -> bool:
return True
async def health(self) -> bool:
return True
def create_engine(path: str = "data.db") -> MyStorage:
"""Factory: create a MyStorage instance."""
return MyStorage(path=path)
def register_plugin():
"""Call when the plugin loads."""
register(
name="my-engine",
type="engine",
factory=create_engine,
version="0.1.0",
description="My custom engine",
)
# Your payment Intent (CRITICAL):
# → validate (built-in)
# → authorize (evoid-auth plugin)
# → audit (evoid-auth plugin)
# → protect (built-in)
# → handler (your code)
# Your cache Intent (EPHEMERAL):
# → validate (built-in)
# → handler (your code, which calls evoid-redis)
# Same codebase, different infrastructure. The level decides.
```
Plugin Types
| Type | Purpose | Example |
|---|---|---|
adapter | Transport layer | ASGI, Telegram, WebSocket, Godot |
engine | Infrastructure | Storage, cache, DI, auth, scheduler |
language | Runtime support | Rust, Go |
processor | Pipeline step | Custom validation, auth, audit |
What You Learned
| Concept | What It Is |
|---|---|
| Plugin registry | Register and resolve plugins by name |
| Plugin manifest | MANIFEST dict in __init__.py |
| Plugin types | adapter, engine, language, processor |
| Installing | evo plug install |
Next: AI Analytics
Add AI-powered analytics next: AI Analytics.