1 utils.console.formatting

utils.console.formatting

Shared Rich formatting helpers for human-facing package CLIs.

The helpers in this module are intentionally small. CLI modules remain responsible for building domain payloads, while this module centralizes common terminal rendering choices: auto terminal detection, compact key/value panels, count tables, and numeric distribution tables.

1.1 Functions

Name Description
cli_console Return a project console that lets Rich detect terminal capabilities.
counts_table Build a two-column table for named counts.
distribution_table Build a table for percentile distributions.
format_value Format a scalar value for compact CLI tables.
key_value_panel Build a compact panel containing key/value rows.
pretty_label Format labels by replacing underscores and title-casing words.
rows_table Build a general table from column names and row values.
summary_table Build a table for count/min/mean/max style summaries.

1.1.1 cli_console

utils.console.formatting.cli_console()

Return a project console that lets Rich detect terminal capabilities.

1.1.2 counts_table

utils.console.formatting.counts_table(title, counts)

Build a two-column table for named counts.

1.1.3 distribution_table

utils.console.formatting.distribution_table(title, summaries)

Build a table for percentile distributions.

1.1.4 format_value

utils.console.formatting.format_value(value, *, digits=4)

Format a scalar value for compact CLI tables.

1.1.5 key_value_panel

utils.console.formatting.key_value_panel(title, rows)

Build a compact panel containing key/value rows.

1.1.6 pretty_label

utils.console.formatting.pretty_label(text)

Format labels by replacing underscores and title-casing words.

1.1.7 rows_table

utils.console.formatting.rows_table(title, columns, rows)

Build a general table from column names and row values.

1.1.8 summary_table

utils.console.formatting.summary_table(title, summaries)

Build a table for count/min/mean/max style summaries.

Back to top