From 866a943c7621c918d31401cca283f10a76a4179d Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 2 Jul 2024 10:05:12 -0400 Subject: [PATCH] Export `render.StyleInfo` --- shiny/render/__init__.py | 3 ++- shiny/render/_data_frame_utils/__init__.py | 2 ++ tests/playwright/shiny/components/data_frame/styles/app.py | 7 +++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/shiny/render/__init__.py b/shiny/render/__init__.py index 854e19833..721b3634c 100644 --- a/shiny/render/__init__.py +++ b/shiny/render/__init__.py @@ -12,7 +12,7 @@ DataTable, data_frame, ) -from ._data_frame_utils import CellSelection +from ._data_frame_utils import CellSelection, StyleInfo from ._deprecated import ( # noqa: F401 RenderFunction, # pyright: ignore[reportUnusedImport] RenderFunctionAsync, # pyright: ignore[reportUnusedImport] @@ -46,4 +46,5 @@ "CellPatch", "CellValue", "CellSelection", + "StyleInfo", ) diff --git a/shiny/render/_data_frame_utils/__init__.py b/shiny/render/_data_frame_utils/__init__.py index 5687a5229..a7f2edfb1 100644 --- a/shiny/render/_data_frame_utils/__init__.py +++ b/shiny/render/_data_frame_utils/__init__.py @@ -24,6 +24,7 @@ SelectionModes, as_cell_selection, ) +from ._styles import StyleInfo __all__ = ( "AbstractTabularData", @@ -46,4 +47,5 @@ "SelectionMode", "SelectionModes", "as_cell_selection", + "StyleInfo", ) diff --git a/tests/playwright/shiny/components/data_frame/styles/app.py b/tests/playwright/shiny/components/data_frame/styles/app.py index 5518697a9..f7f5e7f26 100644 --- a/tests/playwright/shiny/components/data_frame/styles/app.py +++ b/tests/playwright/shiny/components/data_frame/styles/app.py @@ -5,7 +5,6 @@ from palmerpenguins import load_penguins_raw from shiny import App, Inputs, render, ui -from shiny.render._data_frame_utils._styles import StyleInfo # Load the dataset penguins = load_penguins_raw() @@ -43,7 +42,7 @@ # ) # df_styles = gt_styles(df_gt) -df_styles: list[StyleInfo] = [ +df_styles: list[render.StyleInfo] = [ { "location": "body", "rows": None, @@ -105,11 +104,11 @@ def fn_styles(): counter = 0 - def df_styles_fn(data: pd.DataFrame) -> list[StyleInfo]: + def df_styles_fn(data: pd.DataFrame) -> list[render.StyleInfo]: nonlocal counter counter = (counter + 1) % len(df_styles) - ret: list[StyleInfo] = [] + ret: list[render.StyleInfo] = [] for style in df_styles: style_val = style.get("style", None) if style_val is None: