Plugin Author Guide¶
This guide covers how to build and ship external plugins for honestroles.
1. Start from Template¶
Copy the scaffold:
plugin_template/
It includes:
- plugin package layout
- entrypoint config
- contract tests
- registration hooks
You can scaffold directly from this repository:
2. Implement Plugin Functions¶
Each function receives a DataFrame and returns a validated shape:
- filter plugin:
pd.Seriesmask - label plugin:
pd.DataFrame - rate plugin:
pd.DataFrame
Keep plugins deterministic and side-effect free.
3. Register with Metadata¶
from honestroles.plugins import PluginSpec, register_filter_plugin
register_filter_plugin(
"only_usa",
only_usa,
spec=PluginSpec(
api_version="1.0",
plugin_version="0.1.0",
capabilities=("filter", "geo"),
),
)
4. Choose Loading Strategy¶
Option A: Explicit registration in user code¶
Call plugin register_plugins() at app startup.
Option B: Python entrypoints¶
Declare entrypoints under one of:
honestroles.filter_pluginshonestroles.label_pluginshonestroles.rate_plugins
Then call load_plugins_from_entrypoints().
5. Testing Requirements¶
Recommended minimum test set:
- plugin output type contract
- deterministic behavior on fixed input
- edge handling for nulls/empty rows
- metadata compatibility (
api_version)
6. Publishing Checklist¶
- Include
PluginSpecin registrations. - Add README with usage examples.
- Add changelog and semantic version tags.
- Verify compatibility against latest
honestroles. - Submit to
plugins-index/plugins.tomlfor discovery.