[AUR-387, AUR-425] Add start-project to CLI (#29)

This commit is contained in:
cin-jacky
2023-10-03 13:55:34 +09:00
committed by GitHub
parent d83c22aa4e
commit 205955b8a3
13 changed files with 718 additions and 8 deletions

View File

@@ -22,4 +22,4 @@ try:
except ImportError:
pass
__version__ = "0.0.2"
__version__ = "0.0.3"

View File

@@ -3,9 +3,6 @@ import os
import click
import yaml
from kotaemon.contribs.promptui.config import export_pipeline_to_config
from kotaemon.contribs.promptui.ui import build_from_dict
# check if the output is not a .yml file -> raise error
def check_config_format(config):
@@ -39,6 +36,8 @@ def export(export_path, output):
from theflow.utils.modules import import_dotted_string
from kotaemon.contribs.promptui.config import export_pipeline_to_config
sys.path.append(os.getcwd())
cls = import_dotted_string(export_path, safe=False)
export_pipeline_to_config(cls, output)
@@ -48,9 +47,21 @@ def export(export_path, output):
@promptui.command()
@click.argument("run_path", required=False, default="promptui.yml")
def run(run_path):
from kotaemon.contribs.promptui.ui import build_from_dict
build_from_dict(run_path)
check_config_format(run_path)
@main.command()
def start_project():
os.system(
"cookiecutter https://github.com/Cinnamon/kotaemon.git"
"--directory='templates/project-default'"
)
if __name__ == "__main__":
main()