Skip to content

Replace util.print_as_yaml with ansi_output.print_matrix#4540

Merged
cidrblock merged 6 commits intomainfrom
chore_rework_matrix_output
Aug 20, 2025
Merged

Replace util.print_as_yaml with ansi_output.print_matrix#4540
cidrblock merged 6 commits intomainfrom
chore_rework_matrix_output

Conversation

@cidrblock
Copy link
Copy Markdown

@cidrblock cidrblock commented Aug 18, 2025

image

Summary

Refactors matrix output to use a dedicated function in ansi_output.py, replacing the generic YAML printer with a purpose-built tree-like display.

Changes

  • New: ansi_output.print_matrix() with tree structure and file path display
  • Removed: util.print_as_yaml() reducing Rich dependency usage in utils
  • Enhanced: Dynamic headers based on subcommand ("Create matrix", "Test matrix", etc.)
  • Improved: Missing playbook warnings with actionable suppression instructions
  • Consistent: Uses Molecule's standard color scheme (green scenarios, yellow actions)

Benefits

  • Cleaner, more readable matrix output
  • Reduced dependency on Rich in core utilities
  • Better UX with file paths and missing playbook guidance
  • Maintains full color environment variable support (NO_COLOR, etc.)

Testing

  • Matrix display works across subcommands (create, test, converge)
  • File path resolution and missing playbook detection
  • Color environment variables respected
  • Existing tests updated and passing

- Move matrix printing from utils to ansi_output module
- Replace YAML output with simplified tree-like format
- Use consistent Molecule colors (green scenarios, yellow actions)
- Add file path display with missing playbook warnings
- Remove Rich dependency from utils module
- Support dynamic headers based on subcommand (create/test/etc)
- Respect NO_COLOR and color environment variables
- Update test expectations to match actual output format
- Scenarios now display as 'default' instead of 'default:'
@cidrblock cidrblock merged commit 071521b into main Aug 20, 2025
23 of 24 checks passed
@cidrblock cidrblock deleted the chore_rework_matrix_output branch August 20, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants