From 5520d6b554e516f3bddd68eec44779a3003de8f0 Mon Sep 17 00:00:00 2001 From: bojiang Date: Mon, 27 May 2024 15:44:29 +0800 Subject: [PATCH] chore: add script --- openllm_next/__main__.py | 19 ++++++++++++------- pyproject.toml | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/openllm_next/__main__.py b/openllm_next/__main__.py index c7d0083c..b51f07ab 100644 --- a/openllm_next/__main__.py +++ b/openllm_next/__main__.py @@ -1,10 +1,11 @@ import typer -from openllm_next.model import app as model_app -from openllm_next.repo import app as repo_app -from openllm_next.serve import serve as local_serve, run as local_run + from openllm_next.cloud import app as cloud_app from openllm_next.common import VERBOSE_LEVEL - +from openllm_next.model import app as model_app +from openllm_next.repo import app as repo_app +from openllm_next.serve import run as local_run +from openllm_next.serve import serve as local_serve app = typer.Typer() @@ -23,11 +24,15 @@ def run(model: str): local_run(model) -def main_callback(verbose: int = 0): +def typer_callback(verbose: int = 0): if verbose: VERBOSE_LEVEL.set(verbose) -if __name__ == "__main__": - app.callback()(main_callback) +def main(): + app.callback()(typer_callback) app() + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml index 2ad37831..e58a3ce3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,5 +18,8 @@ dependencies = [ "pip_requirements_parser", ] +[project.scripts] +openllm = "openllm_next.__main__:main" + [tool.typer] src-dir = "openllm_next"