From ecba1022ada4934835ceac26a05735c13ad28928 Mon Sep 17 00:00:00 2001 From: Mizev Andrew <150728785+carpalsgrabby@users.noreply.github.com> Date: Tue, 25 Nov 2025 09:57:47 +0100 Subject: [PATCH] Add --print-cmd to show each app command --- choose_best_layout.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/choose_best_layout.py b/choose_best_layout.py index 8ac4dc2..84becd5 100644 --- a/choose_best_layout.py +++ b/choose_best_layout.py @@ -36,6 +36,12 @@ def parse_args() -> argparse.Namespace: required=True, help="Number of leaves in the tree.", ) + p.add_argument( + "--print-cmd", + action="store_true", + help="Print the app.py command for each fanout.", + ) + p.add_argument( "--style", choices=["aztec", "zama", "soundness"], @@ -64,7 +70,7 @@ def parse_args() -> argparse.Namespace: return p.parse_args() -def run_app(app_path: Path, leaves: int, style: str, fanout: int) -> Dict[str, Any]: +def run_app(app_path: Path, leaves: int, style: str, fanout: int, print_cmd: bool = False) -> Dict[str, Any]: cmd = [ sys.executable, str(app_path), @@ -75,6 +81,9 @@ def run_app(app_path: Path, leaves: int, style: str, fanout: int) -> Dict[str, A str(fanout), "--json", ] + if print_cmd: + print(">>", " ".join(cmd), file=sys.stderr) + result = subprocess.run( cmd, text=True, @@ -118,7 +127,7 @@ def main() -> None: for f in args.fanouts: try: - data = run_app(app_path, args.leaves, args.style, f) + data = run_app(app_path, args.leaves, args.style, f, print_cmd=args.print_cmd) layouts.append(LayoutResult(fanout=f, data=data)) except Exception as e: # noqa: BLE001 print(f"ERROR for fanout={f}: {e}", file=sys.stderr)