Skip to content

Commit 7c4f89c

Browse files
committed
Fix the demo shiny app with tabs
1 parent ec67fff commit 7c4f89c

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

docs/changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ITables ChangeLog
66

77
**Fixed**
88
- We have adjusted the generation of the Polars sample dataframes to fix the CI ([Polars-18130](https://github.com/pola-rs/polars/issues/18130))
9+
- The test on the Shiny app fallbacks to `ui.nav_panel` when `ui.nav` is not available
910

1011

1112
2.1.4 (2024-07-03)

tests/sample_python_apps/itables_in_a_shiny_app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Run this app with "shiny run file.py"
12
from shiny import App, ui
23

34
from itables.sample_dfs import get_countries
@@ -8,4 +9,3 @@
89
app_ui = ui.page_fluid(ui.HTML(DT(df)))
910

1011
app = App(app_ui, server=None)
11-
# app.run()

tests/sample_python_apps/itables_in_a_shiny_app_with_tabs.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1+
# Run this app with "shiny run file.py"
12
from shiny import App, ui
23

34
from itables.sample_dfs import get_dict_of_test_dfs
45
from itables.shiny import DT
56

7+
try:
8+
# This one is not available on the CI (Python 3.8)
9+
ui_nav = ui.nav
10+
except AttributeError:
11+
ui_nav = ui.nav_panel
12+
613
app_ui = ui.page_fluid(
714
# Display the different tables in different tabs
815
ui.navset_tab(
9-
*[ui.nav(name, ui.HTML(DT(df))) for name, df in get_dict_of_test_dfs().items()]
16+
*[ui_nav(name, ui.HTML(DT(df))) for name, df in get_dict_of_test_dfs().items()]
1017
)
1118
)
1219

1320
app = App(app_ui, server=None)
14-
# app.run()

0 commit comments

Comments
 (0)