fix(quickstart): invoke train via subprocess to avoid Typer OptionInfo leak

Calling train_cmd() directly bypassed Typer's argument resolution, so
typer.Option(...) defaults arrived as OptionInfo objects instead of
resolved values, crashing later with 'OptionInfo > int' errors.

Use subprocess.run() with the real CLI entry point instead — same
invocation a user would run by hand, and Typer fully resolves all
defaults.
This commit is contained in:
Alpamys 2026-05-04 00:07:37 +05:00
parent bb8c0e073e
commit 10a13bd8d9
1 changed files with 9 additions and 3 deletions

View File

@ -130,8 +130,14 @@ def quickstart(
console.print(f"To train: [bold]soup train --config {config_path}[/]")
raise typer.Exit()
# 3. Train
# 3. Train — invoke via subprocess so Typer resolves defaults properly
console.print("\n[bold]Starting training...[/]\n")
from soup_cli.commands.train import train as train_cmd
import subprocess
import sys
train_cmd(config=str(config_path), yes=True)
result = subprocess.run(
[sys.executable, "-m", "soup_cli.cli", "train", "--config", str(config_path), "--yes"],
check=False,
)
if result.returncode != 0:
raise typer.Exit(result.returncode)