This guide walks you through creating a new ERAD plugin.
Every plugin lives under plugins/ and follows the standard src layout:
plugins/erad-plugin-<name>/
├── pyproject.toml
├── README.md
├── src/
│ └── erad_plugin_<name>/
│ ├── __init__.py
│ └── plugin.py
└── tests/
├── __init__.py
└── test_plugin.py
Copy an existing plugin as a starting point:
cp -r plugins/erad-plugin-forefire plugins/erad-plugin-<name>Rename the source package:
mv plugins/erad-plugin-<name>/src/erad_plugin_forefire \
plugins/erad-plugin-<name>/src/erad_plugin_<name>Edit the plugin's pyproject.toml:
- Set
nametoerad-plugin-<name>. - Update
description,authors, anddependencies. - Register the entry point:
[project.entry-points."erad.plugins"]
<name> = "erad_plugin_<name>.plugin:register"In src/erad_plugin_<name>/plugin.py, implement your plugin logic. The register() function serves as the entry point that ERAD will call to discover the plugin.
Your plugin can produce any ERAD hazard model type (`FireModel`, `EarthQuakeModel`, `FloodModel`, `WindModel`). As long as you return valid model objects, ERAD's `HazardSimulator` will handle the rest.
Write tests under tests/. The plugin's pyproject.toml includes pytest as a dev dependency.
cd plugins/erad-plugin-<name>
pip install -e '.[dev]'
pytestAdd a docs page under docs/plugins/<name>/ and register it in docs/_toc.yml.
- Naming: Use
erad-plugin-<name>for the package anderad_plugin_<name>for the Python module. - Entry points: Register under the
erad.pluginsgroup so ERAD can auto-discover plugins. - Dependencies: Declare
NREL-eradas a dependency in your plugin'spyproject.toml. - Testing: Each plugin must have its own test suite under
tests/.