Coverage for src / rhiza / __main__.py: 100%
15 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-02 07:04 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-02 07:04 +0000
1"""Rhiza module entry point.
3This module allows running the Rhiza CLI with `python -m rhiza` by
4delegating execution to the Typer application defined in `rhiza.cli`.
5"""
7from importlib.metadata import entry_points
9import typer
10from loguru import logger
12from rhiza.cli import app
15def load_plugins(app: typer.Typer) -> None:
16 """Load plugins from entry points."""
17 # 'rhiza.plugins' matches the group we defined in rhiza-tools
18 plugin_entries = entry_points(group="rhiza.plugins")
20 for entry in plugin_entries:
21 try:
22 plugin_app = entry.load()
23 # This adds the plugin as a subcommand, e.g., 'rhiza tools bump'
24 app.add_typer(plugin_app, name=entry.name)
25 except Exception as e:
26 logger.warning(f"Failed to load plugin {entry.name}: {e}")
29if __name__ == "__main__":
30 load_plugins(app)
32 app()