Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@
## 2026-04-16 - [Cohesive Branding in CLI and Dashboards]
**Learning:** For tool-sets with both a CLI and a web-based dashboard (like Prefect), maintaining a consistent "brand" (e.g., specific color schemes like 'bold blue' and emoji usage) across both interfaces creates a more unified and professional user experience. Standardizing the "Result" panel and task naming conventions makes the entire system feel like a single, cohesive product.
**Action:** Apply consistent branding (colors, titles, emojis) to both terminal output and dashboard metadata to ensure a unified user experience across all interfaces.

## 2026-04-17 - [Dynamic Pluralization and Visual Breathing Room]
**Learning:** For tutorial scripts, using dynamic pluralization (e.g., "1 customer" vs. "5 customers") ensures the UI remains grammatically correct and polished regardless of data volume. Additionally, adding explicit `padding=(1, 2)` to `Panel` components prevents the content from feeling "cramped," especially in final summaries where visual balance is key to a professional feel.
**Action:** Always implement dynamic pluralization for key nouns and ensure result panels have adequate internal padding for a clean, professional aesthetic.
14 changes: 10 additions & 4 deletions 01_getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ def main():
with console.status("[bold green]🔍 Fetching customer data..."):
customer_ids = get_customer_ids()

# Add dynamic pluralization for better UX
customer_label = "customer ID" if len(customer_ids) == 1 else "customer IDs"
console.print(
f"[bold blue]📦 Successfully fetched [bold cyan]{len(customer_ids)}[/bold cyan] customer IDs[/bold blue]"
f"[bold blue]📦 Successfully fetched [bold cyan]{len(customer_ids)}[/bold cyan] {customer_label}[/bold blue]"
)
console.print()

with console.status("[bold green]⚙️ Processing customers..."):
processing_label = "customer" if len(customer_ids) == 1 else "customers"
with console.status(f"[bold green]⚙️ Processing {processing_label}..."):
futures = process_customer.map(customer_ids)
# Explicitly wait for results to avoid AttributeErrors on futures
results = [f.result() for f in futures]
Expand Down Expand Up @@ -95,18 +98,21 @@ def main():
console.print(table)
console.print()

# Add dynamic pluralization and visual breathing room to the result panel
result_label = "customer" if len(results) == 1 else "customers"
console.print(
Panel.fit(
f"[bold green]Successfully processed [bold cyan]{len(results)}[/bold cyan] customers in [bold cyan]{duration:.2f}s[/bold cyan]![/bold green]",
f"[bold green]Successfully processed [bold cyan]{len(results)}[/bold cyan] {result_label} in [bold cyan]{duration:.2f}s[/bold cyan]![/bold green]",
title="✨ Result",
border_style="bold blue",
padding=(1, 2),
)
)

console.print()
console.print(Rule("🚀 Next Step", style="bold blue"))
console.print(
"[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]"
"[bold blue]➡️[/bold blue] [bold blue]Try running[/bold blue] [bold cyan]python 02_logging.py[/bold cyan] [bold blue]to learn about logging in Prefect![/bold blue]"
)

return results
Expand Down
20 changes: 15 additions & 5 deletions 02_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ def get_customer_ids() -> list[str]:
def process_customer(customer_id: str) -> str:
"""Process a single customer."""
logger = get_run_logger()
for _ in range(3):
steps = 3
for i in range(steps):
# Add a brief pause to make the logging visible and realistic
time.sleep(0.05)
logger.info(f"Processing customer {customer_id}")
# Add step progress to the logs for better clarity
logger.info(f"Processing customer {customer_id} (step {i+1}/{steps})")
return f"Processed {customer_id}"


Expand Down Expand Up @@ -64,12 +66,17 @@ def main():
with console.status("[bold green]🔍 Fetching customer data..."):
customer_ids = get_customer_ids()

# Add dynamic pluralization for better UX
customer_label = "customer ID" if len(customer_ids) == 1 else "customer IDs"
console.print(
f"[bold blue]📦 Successfully fetched [bold cyan]{len(customer_ids)}[/bold cyan] customer IDs[/bold blue]"
f"[bold blue]📦 Successfully fetched [bold cyan]{len(customer_ids)}[/bold cyan] {customer_label}[/bold blue]"
)
console.print()

with console.status("[bold green]⚙️ Processing customers with logging..."):
processing_label = "customer" if len(customer_ids) == 1 else "customers"
with console.status(
f"[bold green]⚙️ Processing {processing_label} with logging..."
):
futures = process_customer.map(customer_ids)
# Explicitly wait for results to avoid AttributeErrors on futures
results = [f.result() for f in futures]
Expand Down Expand Up @@ -104,11 +111,14 @@ def main():
console.print(table)
console.print()

# Add dynamic pluralization and visual breathing room to the result panel
result_label = "customer" if len(results) == 1 else "customers"
console.print(
Panel.fit(
f"[bold green]Successfully processed [bold cyan]{len(results)}[/bold cyan] customers with detailed logging in [bold cyan]{duration:.2f}s[/bold cyan]![/bold green]",
f"[bold green]Successfully processed [bold cyan]{len(results)}[/bold cyan] {result_label} with detailed logging in [bold cyan]{duration:.2f}s[/bold cyan]![/bold green]",
title="📊 Result",
border_style="bold blue",
padding=(1, 2),
)
)

Expand Down
Loading