refactor(cli): move out to its own packages (#619)

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
This commit is contained in:
Aaron Pham
2023-11-12 18:25:44 -05:00
committed by GitHub
parent 38a7d2a5b5
commit e0632a85ed
22 changed files with 70 additions and 48 deletions

View File

@@ -10,14 +10,17 @@ import tomlkit
from ghapi.all import GhApi
if t.TYPE_CHECKING:
from tomlkit.items import Array, Table
from tomlkit.items import Array
from tomlkit.items import Table
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(ROOT, 'openllm-python', 'src'))
import openllm
_OWNER, _REPO = 'bentoml', 'openllm'
@@ -292,15 +295,15 @@ def keywords() -> Array:
def build_cli_extensions() -> Table:
table = tomlkit.table()
ext: dict[str, str] = {'openllm': 'openllm.cli.entrypoint:cli'}
ext: dict[str, str] = {'openllm': 'openllm_cli.entrypoint:cli'}
ext.update(
{
f'openllm-{inflection.dasherize(ke)}': f'openllm.cli.extension.{ke}:cli'
f'openllm-{inflection.dasherize(ke)}': f'openllm_cli.extension.{ke}:cli'
for ke in sorted(
[
fname[:-3]
for fname in os.listdir(
os.path.abspath(os.path.join(ROOT, 'openllm-python', 'src', 'openllm', 'cli', 'extension'))
os.path.abspath(os.path.join(ROOT, 'openllm-python', 'src', 'openllm_cli', 'extension'))
)
if fname.endswith('.py') and not fname.startswith('__')
]