Skip to content

pytest_park.core.reporting

source module pytest_park.core.reporting

Classes

  • ReportTableBuilder — Builds individual Rich tables for benchmark analysis output.

  • BenchmarkReporter — Orchestrates benchmark analysis output: assembles and renders all report sections.

Functions

source class ReportTableBuilder()

Builds individual Rich tables for benchmark analysis output.

Methods

  • render — Render a Rich Table to a string, with ANSI colour codes only when output is a TTY.

  • improvement_cell — Return a right-justified Rich Text coloured green (improvement) or red (regression).

  • regression_table — Build a flat regression table comparing each method to the previous run.

  • postfix_comparison_tables — Build one Rich table per method group comparing original-postfix vs reference-postfix methods.

source staticmethod ReportTableBuilder.render(table: Table) → str

Render a Rich Table to a string, with ANSI colour codes only when output is a TTY.

source staticmethod ReportTableBuilder.improvement_cell(value: float | None, *, is_pct: bool = False) → Text

Return a right-justified Rich Text coloured green (improvement) or red (regression).

source method ReportTableBuilder.regression_table(improvements: list[MethodImprovement], *, candidate_label: str, reference_label: str) → str

Build a flat regression table comparing each method to the previous run.

source method ReportTableBuilder.postfix_comparison_tables(improvements: list[MethodImprovement], *, original_postfixes: list[str], reference_postfixes: list[str]) → list[str]

Build one Rich table per method group comparing original-postfix vs reference-postfix methods.

source class BenchmarkReporter(table_builder: ReportTableBuilder | None = None)

Orchestrates benchmark analysis output: assembles and renders all report sections.

Methods

source staticmethod BenchmarkReporter.benchmark_header_label(source_file: str | None, fallback: str) → str

Return a compact table header label for a benchmark source file path.

source staticmethod BenchmarkReporter.format_improvement_value(value: float | None, *, is_pct: bool = False) → str

Format one analysis value for terminal output.

source staticmethod BenchmarkReporter.format_delta_line(delta: BenchmarkDelta, *, baseline_label: str | None = None) → str

Format a single benchmark delta as a concise summary line.

source build_regression_table(improvements: list[MethodImprovement], *, candidate_label: str, reference_label: str) → str

Build a flat regression table comparing each method to the previous run.

source build_postfix_comparison_table(improvements: list[MethodImprovement], *, original_postfixes: list[str], reference_postfixes: list[str]) → list[str]

Build one Rich table per method group for postfix comparison.

source build_benchmark_header_label(source_file: str | None, fallback: str) → str

Return a compact table header label for a benchmark source.

source format_improvement_value(value: float | None, *, is_pct: bool = False) → str

Format one analysis value for terminal table output.

source format_delta_line(delta: BenchmarkDelta, *, baseline_label: str | None = None) → str

Format a single benchmark delta as a concise summary line.