From 10a13bd8d9de6c25205b5fb3208f9944777ccea2 Mon Sep 17 00:00:00 2001 From: Alpamys Date: Mon, 4 May 2026 00:07:37 +0500 Subject: [PATCH] fix(quickstart): invoke train via subprocess to avoid Typer OptionInfo leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- soup_cli/commands/quickstart.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/soup_cli/commands/quickstart.py b/soup_cli/commands/quickstart.py index 08422b0..f57e7c0 100644 --- a/soup_cli/commands/quickstart.py +++ b/soup_cli/commands/quickstart.py @@ -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)