| """Root Typer application for hf-release.""" | |
| from __future__ import annotations | |
| import typer | |
| from rich.traceback import install as install_rich_tb | |
| from . import __version__ | |
| from .commands.release import app as release_app | |
| from .utils.display import console, print_error | |
| from .utils.exceptions import HFReleaseError | |
| # Never leak tokens in tracebacks | |
| install_rich_tb(show_locals=False) | |
| app = typer.Typer( | |
| name="hf-release", | |
| rich_markup_mode="rich", | |
| pretty_exceptions_show_locals=False, | |
| add_completion=True, | |
| help=( | |
| "[bold]hf-release[/bold] — publish model weights to [cyan]Hugging Face Hub[/cyan] " | |
| "and create a [green]GitHub Release[/green] in one atomic command." | |
| ), | |
| ) | |
| app.add_typer(release_app, name="release") | |
| def _version_callback(value: bool) -> None: | |
| if value: | |
| typer.echo(f"hf-release {__version__}") | |
| raise typer.Exit() | |
| def main( | |
| version: bool = typer.Option( | |
| False, | |
| "--version", | |
| "-V", | |
| callback=_version_callback, | |
| is_eager=True, | |
| help="Show version and exit.", | |
| ), | |
| ) -> None: | |
| pass | |