Coverage for src / rhiza / __main__.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-02-12 20:13 +0000

1"""Rhiza module entry point. 

2 

3This module allows running the Rhiza CLI with `python -m rhiza` by 

4delegating execution to the Typer application defined in `rhiza.cli`. 

5""" 

6 

7from importlib.metadata import entry_points 

8 

9import typer 

10 

11from rhiza.cli import app 

12 

13 

14def load_plugins(app: typer.Typer) -> None: 

15 """Load plugins from entry points.""" 

16 # 'rhiza.plugins' matches the group we defined in rhiza-tools 

17 plugin_entries = entry_points(group="rhiza.plugins") 

18 

19 for entry in plugin_entries: 

20 try: 

21 plugin_app = entry.load() 

22 # This adds the plugin as a subcommand, e.g., 'rhiza tools bump' 

23 app.add_typer(plugin_app, name=entry.name) 

24 except Exception as e: 

25 print(f"Failed to load plugin {entry.name}: {e}") 

26 

27 

28load_plugins(app) 

29 

30 

31if __name__ == "__main__": 

32 app()