-
Notifications
You must be signed in to change notification settings - Fork 757
/
cli.py
57 lines (41 loc) · 2.47 KB
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from __future__ import annotations
import click
import psutil
from bentoml import __version__ as BENTOML_VERSION
from bentoml_cli.env import add_env_command
from bentoml_cli.serve import add_serve_command
from bentoml_cli.utils import BentoMLCommandGroup
from bentoml_cli.yatai import add_login_command
from bentoml_cli.bentos import add_bento_management_commands
from bentoml_cli.models import add_model_management_commands
from bentoml_cli.containerize import add_containerize_command
def create_bentoml_cli() -> click.Group:
from bentoml._internal.context import component_context
component_context.component_name = "cli"
CONTEXT_SETTINGS = {"help_option_names": ("-h", "--help")}
@click.group(cls=BentoMLCommandGroup, context_settings=CONTEXT_SETTINGS)
@click.version_option(BENTOML_VERSION, "-v", "--version")
def bentoml_cli():
"""
\b
██████╗░███████╗███╗░░██╗████████╗░█████╗░███╗░░░███╗██╗░░░░░
██╔══██╗██╔════╝████╗░██║╚══██╔══╝██╔══██╗████╗░████║██║░░░░░
██████╦╝█████╗░░██╔██╗██║░░░██║░░░██║░░██║██╔████╔██║██║░░░░░
██╔══██╗██╔══╝░░██║╚████║░░░██║░░░██║░░██║██║╚██╔╝██║██║░░░░░
██████╦╝███████╗██║░╚███║░░░██║░░░╚█████╔╝██║░╚═╝░██║███████╗
╚═════╝░╚══════╝╚═╝░░╚══╝░░░╚═╝░░░░╚════╝░╚═╝░░░░░╚═╝╚══════╝
"""
# Add top-level CLI commands
add_env_command(bentoml_cli)
add_login_command(bentoml_cli)
add_bento_management_commands(bentoml_cli)
add_model_management_commands(bentoml_cli)
add_serve_command(bentoml_cli)
add_containerize_command(bentoml_cli)
if psutil.WINDOWS:
import sys
sys.stdout.reconfigure(encoding="utf-8") # type: ignore
return bentoml_cli
cli = create_bentoml_cli()
if __name__ == "__main__":
cli()