From 09d70ece499f65acc6963315d9bbc51249955a6d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 12 Apr 2026 05:15:07 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Polish=20CLI=20UX=20a?= =?UTF-8?q?nd=20fix=20syntax=20errors=20in=20demo=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix syntax errors and remove redundant code blocks in `01_getting_started.py` and `02_logging.py`. - Standardize on `bold blue` for Panels, Rules, and instructional text for better visual hierarchy and contrast. - Use `footer_style="bold"` in `rich.Table` for cleaner code and consistent visual weight. - Ensure all generated IDs are unique using `random.sample`. - Add consistent descriptive titles to `rich.Rule` components. Co-authored-by: ruh-al-tarikh <203426218+ruh-al-tarikh@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ 01_getting_started.py | 28 +++++++++------------------- 02_logging.py | 30 +++++++++--------------------- 3 files changed, 22 insertions(+), 40 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index 7ea5bd4..ce1da8c 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -31,3 +31,7 @@ ## 2026-04-02 - [Micro-UX Polish for Demo CLI Scripts] **Learning:** For tutorial-style CLI scaffolds, several micro-UX touches significantly improve the professional feel and onboarding experience: (1) using `random.sample` instead of `random.choices` for unique mock data generation; (2) displaying the total execution duration in the final success panel; and (3) adding descriptive titles to `rich.Rule` components for better visual hierarchy between results and "Next Step" guidance. **Action:** Ensure all demo scripts use unique mock data, provide performance feedback via execution duration, and utilize rule-titles for clear sectional separation. + +## 2026-04-04 - [Consistent Visual Hierarchy and Accessibility in CLI] +**Learning:** Using 'bold blue' for all structural components (Panels, Rules, and instructional text) creates a strong, consistent visual hierarchy and improves accessibility by ensuring sufficient contrast. Applying `footer_style="bold"` in `rich.table.Table` definitions instead of inline markup maintains cleaner code and consistent visual weight for summary data. +**Action:** Standardize on `bold blue` for CLI structural elements and use explicit `footer_style` properties in tables to ensure high-contrast, professional-grade terminal interfaces. diff --git a/01_getting_started.py b/01_getting_started.py index 862f738..82b2873 100644 --- a/01_getting_started.py +++ b/01_getting_started.py @@ -16,11 +16,6 @@ def get_customer_ids() -> list[str]: """Fetch customer IDs from a database or API.""" # Use sorted and zero-padded IDs for better terminal alignment # Use random.sample to ensure unique IDs in the demo output - # Use random.sample to ensure unique customer IDs - ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] - # Using random.sample ensures unique IDs for a more realistic demo - ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] - # Use random.sample to ensure unique customer IDs in the demo ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] return sorted(ids) @@ -50,7 +45,7 @@ def main(): Panel( Markdown(main.__doc__.strip()), title="Prefect Workflow Guide", - border_style="blue", + border_style="bold blue", padding=(1, 2), ) ) @@ -71,9 +66,10 @@ def main(): results = [f.result() for f in futures] # Calculate duration + duration = time.perf_counter() - start_time + # Add visual breathing room before results console.print() - duration = time.perf_counter() - start_time # Display results in a clean table for better readability table = Table( @@ -83,9 +79,12 @@ def main(): show_footer=True, box=box.ROUNDED, ) - table.add_column("Customer ID", style="cyan", footer="Total") + table.add_column("Customer ID", style="cyan", footer="Total", footer_style="bold") table.add_column( - "Status", style="green", footer=f"[bold]{len(results)} Processed[/bold]" + "Status", + style="green", + footer=f"{len(results)} Processed", + footer_style="bold", ) # Use zip to map results back to their original IDs more reliably @@ -95,8 +94,6 @@ def main(): console.print(table) console.print() - duration = time.perf_counter() - start_time - console.print( Panel.fit( f"[bold green]✨ Successfully processed {len(results)} customers in {duration:.2f}s![/bold green]", @@ -105,17 +102,10 @@ def main(): ) ) - console.print(Rule("Next Step", style="blue")) - console.print( - "➡️ Try running [cyan]python 02_logging.py[/cyan] to learn about logging in Prefect!" - console.print( - "Try running [cyan]python 02_logging.py[/cyan] to learn about logging in Prefect!" - console.print( - "Try running [cyan]python 02_logging.py[/cyan] to learn about logging in Prefect!" console.print() console.print(Rule("🚀 Next Step", style="bold blue")) console.print( - "[bold blue]➡️[/bold blue] Try running [cyan]python 02_logging.py[/cyan] to learn about logging in Prefect!" + "[bold blue]➡️[/bold blue] [bold blue]Try running[/bold blue] [cyan]python 02_logging.py[/cyan] [bold blue]to learn about logging in Prefect![/bold blue]" ) return results diff --git a/02_logging.py b/02_logging.py index 6d82c23..be6a13c 100644 --- a/02_logging.py +++ b/02_logging.py @@ -17,11 +17,6 @@ def get_customer_ids() -> list[str]: """Fetch customer IDs from a database or API.""" # Use sorted and zero-padded IDs for better terminal alignment # Use random.sample to ensure unique IDs in the demo output - # Use random.sample to ensure unique customer IDs - ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] - # Using random.sample ensures unique IDs for a more realistic demo - ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] - # Use random.sample to ensure unique customer IDs in the demo ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] return sorted(ids) @@ -59,7 +54,7 @@ def main(): Panel( Markdown(main.__doc__.strip()), title="Prefect Workflow Guide", - border_style="blue", + border_style="bold blue", padding=(1, 2), ) ) @@ -80,9 +75,10 @@ def main(): results = [f.result() for f in futures] # Calculate duration + duration = time.perf_counter() - start_time + # Add visual breathing room before results console.print() - duration = time.perf_counter() - start_time # Display results in a clean table for better readability table = Table( @@ -92,9 +88,12 @@ def main(): show_footer=True, box=box.ROUNDED, ) - table.add_column("Customer ID", style="cyan", footer="Total") + table.add_column("Customer ID", style="cyan", footer="Total", footer_style="bold") table.add_column( - "Status", style="green", footer=f"[bold]{len(results)} Processed[/bold]" + "Status", + style="green", + footer=f"{len(results)} Processed", + footer_style="bold", ) # Use zip to map results back to their original IDs more reliably @@ -104,29 +103,18 @@ def main(): console.print(table) console.print() - duration = time.perf_counter() - start_time console.print( Panel.fit( f"[bold green]✨ Successfully processed {len(results)} customers with detailed logging in {duration:.2f}s![/bold green]", - - console.print( - Panel.fit( - f"[bold green]✨ Successfully processed {len(results)} customers with detailed logging in {duration:.2f}s![/bold green]", - f"[bold green]✨ Successfully processed {len(results)} customers in {duration:.2f}s![/bold green]", title="Result", border_style="green", ) ) - console.print(Rule("Conclusion", style="blue")) - console.print(Rule("Next Step", style="blue")) - console.print(Rule("Conclusion", style="blue")) - console.print( - "🎉 You've completed the Quickstart! Check out the [cyan]README.md[/cyan] for more features." console.print() console.print(Rule("🎉 Finishing Up", style="bold blue")) console.print( - "🎉 You've completed the Quickstart! Check out the [cyan]README.md[/cyan] for more features." + "[bold blue]🎉 You've completed the Quickstart! Check out the[/bold blue] [cyan]README.md[/cyan] [bold blue]for more features.[/bold blue]" ) return results