From 96f8e8e24c07358b78a9e4561333b0c68debf637 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 05:27:29 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Enhance=20CLI=20UX=20?= =?UTF-8?q?and=20terminal=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented several micro-UX improvements to the demo scripts: - Added `rich.console.status` spinners to simulate data fetching progress. - Reduced default customer count from 50 to 5 in `01_getting_started.py` and `02_logging.py` for better signal-to-noise ratio in terminal output. - Improved visual spacing by adding an empty line before final success panels. - Updated `.Jules/palette.md` with a new journal entry on demo scale vs. terminal readability. Co-authored-by: ruh-al-tarikh <203426218+ruh-al-tarikh@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ 01_getting_started.py | 7 +++++-- 02_logging.py | 7 +++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index ccae255..2677c36 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -5,3 +5,7 @@ ## 2026-03-28 - [Guided CLI Onboarding] **Learning:** For tutorial-style scaffolds, adding "Next Step" guidance directly to the terminal output after a successful run creates a much smoother onboarding experience than relying solely on the README. **Action:** Always include a clear, visually distinct "Next Step" message at the end of introductory scripts to guide users through the intended learning path. + +## 2026-03-30 - [Demo Scale vs. Terminal Readability] +**Learning:** For demo scripts, larger data sets can degrade the UX by flooding the terminal with logs, making it harder for users to see the structure of the output. +**Action:** Limit the default number of items in demo loops (e.g., 5 items) to maintain a high signal-to-noise ratio while still demonstrating the functionality. diff --git a/01_getting_started.py b/01_getting_started.py index 2f57417..4669797 100644 --- a/01_getting_started.py +++ b/01_getting_started.py @@ -10,7 +10,7 @@ @task def get_customer_ids() -> list[str]: # Fetch customer IDs from a database or API - return [f"customer{n}" for n in random.choices(range(100), k=50)] + return [f"customer{n}" for n in random.choices(range(100), k=5)] @task @@ -26,13 +26,16 @@ def main(): This flow demonstrates how to map a task over a list of inputs. It fetches a list of customer IDs and processes each one individually. """ - customer_ids = get_customer_ids() + with console.status("[bold green]Fetching customer data..."): + customer_ids = get_customer_ids() + # Map the process_customer task across all customer IDs console.print(f"[bold blue]📦 Fetched {len(customer_ids)} customer IDs[/bold blue]") with console.status("[bold green]Processing customers..."): results = process_customer.map(customer_ids) + console.print() console.print( Panel.fit( f"[bold green]✅ Successfully processed {len(results)} customers![/bold green]", diff --git a/02_logging.py b/02_logging.py index 5a0753b..f225f64 100644 --- a/02_logging.py +++ b/02_logging.py @@ -11,7 +11,7 @@ @task def get_customer_ids() -> list[str]: # Fetch customer IDs from a database or API - return [f"customer{n}" for n in random.choices(range(100), k=50)] + return [f"customer{n}" for n in random.choices(range(100), k=5)] @task @@ -36,13 +36,16 @@ def main(): - Use the Prefect logger for structured logging in tasks. - Map tasks across a list of inputs. """ - customer_ids = get_customer_ids() + with console.status("[bold green]Fetching customer data..."): + customer_ids = get_customer_ids() + # Map the process_customer task across all customer IDs console.print(f"[bold blue]📦 Fetched {len(customer_ids)} customer IDs[/bold blue]") with console.status("[bold green]Processing customers with logging..."): results = process_customer.map(customer_ids) + console.print() console.print( Panel.fit( f"[bold green]✅ Successfully processed {len(results)} customers with detailed logging![/bold green]",