Plugin recipe rework#206
Conversation
graepaul
left a comment
There was a problem hiding this comment.
Minor comments on a couple of files. Looks good overall.
| if entry_point_name: | ||
| configs[entry_point_name] = config_model | ||
| if config_model.name and config_model.name not in configs: | ||
| configs[config_model.name] = config_model |
There was a problem hiding this comment.
If an entry_point_name != config_model.name then the same plugin will get registered twice
something like
[project.entry-points."nodescraper.plugin_configs"]
NodeStatusPluginConfig = "nodescraper.pluginrecipe.node_status:NodeStatus"
results in
node-scraper describe config
2026-06-01 11:45:33 PDT INFO nodescraper | Log path: ./scraper_logs_mkmgraepaul01_2026_06_01-11_45_33_AM
2026-06-01 11:45:33 PDT INFO nodescraper | Available configs:
AllPlugins
NodeStatus
NodeStatusPluginConfig
| logger.warning( | ||
| "Failed to load plugin config entry point %r: %s", | ||
| entry_point_name, | ||
| exc, | ||
| ) |
There was a problem hiding this comment.
Should an exception be raised here? That way if a badly configured entry-point is input then it will cause execution to stop and the user can fix.
There was a problem hiding this comment.
Could handle ModuleNotFoundError independently from general Exception since that will probably be hit most often
| Returns: | ||
| ConfigRegistry: Registry containing bundled and entry-point plugin configs. | ||
| """ | ||
| del plugin_reg |
There was a problem hiding this comment.
Why del?
can do _plugin_reg = plugin_reg or noqa to make the ruff checks happy.
| @@ -75,16 +75,16 @@ def _parse_plugin_configs_csv(value: str) -> list[str]: | |||
|
|
|||
|
|
|||
| def _config_registry_with_all_plugins(plugin_reg: PluginRegistry) -> ConfigRegistry: | |||
There was a problem hiding this comment.
Could rename to _default_config_registry
Summary
-Reworking plugin recipes by registering recipes through endpoints. This allows other tools to register its own recipes in node-scraper. Recipes can also now be picked up dynamically from init files.
Test plan
pytest test/unitpytest test/functional(if applicable)pre-commit run --all-filesChecklist
Sample run: