import importlib import typer import sys from typing_extensions import Annotated app = typer.Typer() def _load_recipe(dotted_path: str): sys.path.append(".") path, name = dotted_path.rsplit(".", 1) mod = importlib.import_module(path) return getattr(mod, name) @app.command() def reset(recipe: Annotated[str, typer.Option(...)]): mod = _load_recipe(recipe) mod.reset() @app.command() def show(recipe: Annotated[str, typer.Option(...)]): mod = _load_recipe(recipe) mod.show() @app.command() def run(recipe: Annotated[str, typer.Option(...)]): mod = _load_recipe(recipe) mod.run_once() if __name__ == "__main__": app()