From 4d90ded387758d15ce2444ae9ed2f5924e675d32 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 06:56:17 +0000 Subject: [PATCH 1/3] Align Python browser Summary Report presentation with R - Pass sectionGroupPresentation: 'tabs', groupPresentation: 'tabs', and sectionComponentPresentation: 'tabs' to renderReport() in RtichokeBrowserReport. - Embed Summary Report density CSS (_summary_report_density_css()) matching R's summary_report_density_css() behavior. - Update unit tests to assert tabs presentation options and density CSS. Co-authored-by: uriahf <11351434+uriahf@users.noreply.github.com> --- src/rtichoke/_report_browser.py | 55 +++++++++++++++++++++++++++- tests/test_report_browser.py | 5 ++- tests/test_summary_report_browser.py | 4 ++ 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/rtichoke/_report_browser.py b/src/rtichoke/_report_browser.py index 4611aec8..f086770b 100644 --- a/src/rtichoke/_report_browser.py +++ b/src/rtichoke/_report_browser.py @@ -49,6 +49,57 @@ def _sanitize_nan_values(obj: Any) -> Any: return obj +def _summary_report_density_css() -> str: + """Generate layout density CSS for browser summary reports.""" + return ( + ".rtichoke-report {\n" + " max-width: 1040px;\n" + " gap: 1.5rem;\n" + "}\n" + ".rtichoke-report__section {\n" + " gap: 1.25rem;\n" + "}\n" + ".rtichoke-report__group {\n" + " gap: 0.875rem;\n" + "}\n" + ".rtichoke-report__component,\n" + ".rtichoke-report__tabpanel {\n" + " gap: 0.5rem;\n" + "}\n" + ".rtichoke-report .rtichoke-viz-chart {\n" + " min-height: 500px;\n" + " height: 500px;\n" + "}\n" + ".rtichoke-report .rtichoke-calibration {\n" + " min-height: 550px;\n" + " height: 550px;\n" + "}\n" + ".rtichoke-report__tabpanel .rtichoke-report__component-title {\n" + " display: none;\n" + "}\n" + ".rtichoke-report__nav {\n" + " background-color: transparent;\n" + " border: none;\n" + " border-bottom: 1px solid #e5e7eb;\n" + " border-radius: 0;\n" + " padding: 0.5rem 0;\n" + "}\n" + ".rtichoke-report .rtichoke-summary-metrics {\n" + " border: none;\n" + " background: transparent;\n" + " box-shadow: none;\n" + "}\n" + ".rtichoke-report .rtichoke-summary-metrics__title {\n" + " display: none;\n" + "}\n" + ".rtichoke-report .rtichoke-summary-metrics__table th,\n" + ".rtichoke-report .rtichoke-summary-metrics__table td {\n" + " padding: 0.35rem 0.65rem;\n" + " border-bottom: 1px solid #e5e7eb;\n" + "}\n" + ) + + class RtichokeBrowserReport: """A complete canonical ReportSpec rendered by shared ``rtichoke_viz``.""" @@ -76,6 +127,7 @@ def write_html(self, path: str | Path) -> Path: