Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(data frame): Export render.StyleInfo #1488

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion shiny/render/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -46,4 +46,5 @@
"CellPatch",
"CellValue",
"CellSelection",
"StyleInfo",
)
2 changes: 2 additions & 0 deletions shiny/render/_data_frame_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
SelectionModes,
as_cell_selection,
)
from ._styles import StyleInfo

__all__ = (
"AbstractTabularData",
Expand All @@ -46,4 +47,5 @@
"SelectionMode",
"SelectionModes",
"as_cell_selection",
"StyleInfo",
)
7 changes: 3 additions & 4 deletions tests/playwright/shiny/components/data_frame/styles/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -43,7 +42,7 @@
# )
# df_styles = gt_styles(df_gt)

df_styles: list[StyleInfo] = [
df_styles: list[render.StyleInfo] = [
{
"location": "body",
"rows": None,
Expand Down Expand Up @@ -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:
Expand Down
Loading