diff --git a/.Jules/palette.md b/.Jules/palette.md index fcb1212..74d0394 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -13,3 +13,7 @@ ## 2026-03-31 - [Visual Polish for CLI Summaries] **Learning:** In CLI-based workflow scaffolds, replacing raw success messages with structured `rich.table.Table` summaries significantly improves the professional feel and readability of the output. Additionally, zero-padding generated IDs (e.g., 'customer-01') ensures natural sorting and vertical alignment, which reduces cognitive load when scanning lists. Finally, adding minimal artificial delays (e.g., `time.sleep(0.1)`) in demo scripts makes the "work" visible by giving terminal spinners and status indicators enough time to register with the user. **Action:** Use structured tables for final execution summaries, ensure all generated IDs are zero-padded for alignment, and include brief pacing pauses in demo tasks to make the execution flow more perceptible. + +## 2026-04-01 - [CLI Onboarding & Information Density] +**Learning:** For terminal-based workflow scaffolds, rendering the flow's docstring as a 'Prefect Workflow Guide' using `rich.Markdown` inside a `rich.Panel` provides immediate, high-quality context to the user. Additionally, adding footers to summary tables (e.g., total items processed) improves information density and allows users to verify outcomes at a glance. +**Action:** Incorporate a Markdown-rendered welcome panel at the start of main entry points and include summary footers in result tables to enhance clarity and professional feel. diff --git a/01_getting_started.py b/01_getting_started.py index 790b646..8f31d36 100644 --- a/01_getting_started.py +++ b/01_getting_started.py @@ -2,6 +2,7 @@ import random import time from rich.console import Console +from rich.markdown import Markdown from rich.panel import Panel from rich.rule import Rule from rich.table import Table @@ -33,36 +34,55 @@ 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. """ - with console.status("[bold green]Fetching customer data..."): + # Display the flow's purpose for a guided onboarding experience + if main.__doc__: + console.print( + Panel( + Markdown(main.__doc__.strip()), + title="Prefect Workflow Guide", + border_style="blue", + padding=(1, 2), + ) + ) + + console.print() + + with console.status("[bold green]🔍 Fetching customer data..."): customer_ids = get_customer_ids() - console.print(f"[bold blue]📦 Fetched {len(customer_ids)} customer IDs[/bold blue]") + console.print( + f"[bold blue]📦 Successfully fetched {len(customer_ids)} customer IDs[/bold blue]" + ) + console.print() - with console.status("[bold green]Processing customers..."): + with console.status("[bold green]⚙️ Processing customers..."): futures = process_customer.map(customer_ids) # Explicitly wait for results to avoid AttributeErrors on futures results = [f.result() for f in futures] # Display results in a clean table for better readability table = Table( - title="Processing Summary", show_header=True, header_style="bold blue" + title="Processing Summary", + show_header=True, + header_style="bold blue", + show_footer=True, + ) + table.add_column("Customer ID", style="cyan", footer="Total") + table.add_column( + "Status", style="green", footer=f"[bold]{len(results)} Processed[/bold]" ) - table.add_column("Customer ID", style="cyan") - table.add_column("Status", style="green") - for res in results: - # Extract the customer ID from the result string (e.g., "Processed customer-01") - customer_id = res.split()[-1] + # Use zip to map results back to their original IDs more reliably + for customer_id, res in zip(customer_ids, results): table.add_row(customer_id, "✅ Success") - console.print() console.print(table) console.print() console.print( Panel.fit( - f"[bold green]✅ Successfully processed {len(results)} customers![/bold green]", - title="Success", + f"[bold green]✨ Successfully processed {len(results)} customers![/bold green]", + title="Result", border_style="green", ) ) diff --git a/02_logging.py b/02_logging.py index 5eaf0c0..3d14d66 100644 --- a/02_logging.py +++ b/02_logging.py @@ -3,6 +3,7 @@ import random import time from rich.console import Console +from rich.markdown import Markdown from rich.panel import Panel from rich.rule import Rule from rich.table import Table @@ -42,36 +43,55 @@ def main(): - Use the Prefect logger for structured logging in tasks. - Map tasks across a list of inputs. """ - with console.status("[bold green]Fetching customer data..."): + # Display the flow's purpose for a guided onboarding experience + if main.__doc__: + console.print( + Panel( + Markdown(main.__doc__.strip()), + title="Prefect Workflow Guide", + border_style="blue", + padding=(1, 2), + ) + ) + + console.print() + + with console.status("[bold green]🔍 Fetching customer data..."): customer_ids = get_customer_ids() - console.print(f"[bold blue]📦 Fetched {len(customer_ids)} customer IDs[/bold blue]") + console.print( + f"[bold blue]📦 Successfully fetched {len(customer_ids)} customer IDs[/bold blue]" + ) + console.print() - with console.status("[bold green]Processing customers with logging..."): + with console.status("[bold green]⚙️ Processing customers with logging..."): futures = process_customer.map(customer_ids) # Explicitly wait for results to avoid AttributeErrors on futures results = [f.result() for f in futures] # Display results in a clean table for better readability table = Table( - title="Processing Summary", show_header=True, header_style="bold blue" + title="Processing Summary", + show_header=True, + header_style="bold blue", + show_footer=True, + ) + table.add_column("Customer ID", style="cyan", footer="Total") + table.add_column( + "Status", style="green", footer=f"[bold]{len(results)} Processed[/bold]" ) - table.add_column("Customer ID", style="cyan") - table.add_column("Status", style="green") - for res in results: - # Extract the customer ID from the result string (e.g., "Processed customer-01") - customer_id = res.split()[-1] + # Use zip to map results back to their original IDs more reliably + for customer_id, res in zip(customer_ids, results): table.add_row(customer_id, "✅ Success") - console.print() console.print(table) console.print() console.print( Panel.fit( - f"[bold green]✅ Successfully processed {len(results)} customers with detailed logging![/bold green]", - title="Success", + f"[bold green]✨ Successfully processed {len(results)} customers with detailed logging![/bold green]", + title="Result", border_style="green", ) )