From 6fcf58f870c895c6f2d7072a9a3703318327bc99 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 21 May 2024 17:05:16 -0400 Subject: [PATCH 1/7] Rename `@render.data_frame` method `.input_cell_selection()` to `.cell_selection()` --- .../outputs/data-grid/app-variation-select-rows-core.py | 2 +- .../outputs/data-grid/app-variation-select-rows-express.py | 2 +- components/outputs/data-grid/index.qmd | 6 +++--- .../outputs/datatable/app-variation-select-rows-core.py | 2 +- .../outputs/datatable/app-variation-select-rows-express.py | 2 +- components/outputs/datatable/index.qmd | 6 +++--- py-shiny | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/outputs/data-grid/app-variation-select-rows-core.py b/components/outputs/data-grid/app-variation-select-rows-core.py index 41cc9584..10179d1a 100644 --- a/components/outputs/data-grid/app-variation-select-rows-core.py +++ b/components/outputs/data-grid/app-variation-select-rows-core.py @@ -17,7 +17,7 @@ def penguins_df(): @render.ui def rows(): - rows = penguins_df.input_cell_selection()["rows"] # << + rows = penguins_df.cell_selection()["rows"] # << selected = ", ".join(str(i) for i in sorted(rows)) if rows else "None" return f"Rows selected: {selected}" diff --git a/components/outputs/data-grid/app-variation-select-rows-express.py b/components/outputs/data-grid/app-variation-select-rows-express.py index 68cf1ade..5173593e 100644 --- a/components/outputs/data-grid/app-variation-select-rows-express.py +++ b/components/outputs/data-grid/app-variation-select-rows-express.py @@ -9,7 +9,7 @@ @render.ui() def rows(): - rows = penguins_df.input_cell_selection()["rows"] # << + rows = penguins_df.cell_selection()["rows"] # << selected = ", ".join(str(i) for i in sorted(rows)) if rows else "None" return f"Rows selected: {selected}" diff --git a/components/outputs/data-grid/index.qmd b/components/outputs/data-grid/index.qmd index d3210bba..e90be377 100644 --- a/components/outputs/data-grid/index.qmd +++ b/components/outputs/data-grid/index.qmd @@ -47,7 +47,7 @@ listing: - title: Select Rows description: Set `selection_mode` in `render.DataGrid()` to `"row"` to allow the user to select one row at a time. Set it to `"rows"` to allow the user to select - multiple rows at a time. Access the selection(s) as `.input_cell_selection()["rows"]`. + multiple rows at a time. Access the selection(s) as `.cell_selection()["rows"]`. apps: - title: Preview file: app-variation-select-rows-core.py @@ -130,9 +130,9 @@ To make a reactive Data Grid, follow three steps: A Data Grid can also collect input from the user. To allow this, set `render.DataGrid(selection_mode="row")` or `render.DataGrid(selection_mode="rows")` to allow the user to select one or more rows of the Data Grid. -The indices of the selected rows will be accessible within the server function as a reactive variable returned by `.input_cell_selection()["rows"]`, where is the name of the function decorated with `@render.data_frame`. +The indices of the selected rows will be accessible within the server function as a reactive variable returned by `.cell_selection()["rows"]`, where is the name of the function decorated with `@render.data_frame`. -The value returned will be an empty tuple if no rows are selected, or a tuple of integers representing the indices of the selected rows. To filter a pandas data frame down to the selected rows, use `df.iloc[list(.input_cell_selection()["rows"])]`. +The value returned will be an empty tuple if no rows are selected, or a tuple of integers representing the indices of the selected rows. To filter a pandas data frame down to the selected rows, use `df.iloc[list(.cell_selection()["rows"])]`. For more information about interacting with data frames, see the API documentation for [Express](../../../api/express/express.render.data_frame.qmd) or [Core](../../../api/core/render.data_frame.qmd) syntax. diff --git a/components/outputs/datatable/app-variation-select-rows-core.py b/components/outputs/datatable/app-variation-select-rows-core.py index a9625cb9..af0ef71d 100644 --- a/components/outputs/datatable/app-variation-select-rows-core.py +++ b/components/outputs/datatable/app-variation-select-rows-core.py @@ -17,7 +17,7 @@ def penguins_df(): @render.ui def rows(): - rows = penguins_df.input_cell_selection()["rows"] # << + rows = penguins_df.cell_selection()["rows"] # << selected = ", ".join(str(i) for i in sorted(rows)) if rows else "None" return f"Rows selected: {selected}" diff --git a/components/outputs/datatable/app-variation-select-rows-express.py b/components/outputs/datatable/app-variation-select-rows-express.py index 032e4772..9a8c0bae 100644 --- a/components/outputs/datatable/app-variation-select-rows-express.py +++ b/components/outputs/datatable/app-variation-select-rows-express.py @@ -9,7 +9,7 @@ @render.ui def rows(): - rows = penguins_df.input_cell_selection()["rows"] # << + rows = penguins_df.cell_selection()["rows"] # << selected = ", ".join(str(i) for i in sorted(rows)) if rows else "None" return f"Rows selected: {selected}" diff --git a/components/outputs/datatable/index.qmd b/components/outputs/datatable/index.qmd index baf1cab8..3d40410c 100644 --- a/components/outputs/datatable/index.qmd +++ b/components/outputs/datatable/index.qmd @@ -47,7 +47,7 @@ listing: - title: Select Rows description: Set `selection_mode` in `render.DataTable()` to `"row"` to allow the user to select one row at a time. Set it to `"rows"` to allow the user to - select multiple rows at a time. Access the selection(s) as `.input_cell_selection()["rows"]`. + select multiple rows at a time. Access the selection(s) as `.cell_selection()["rows"]`. apps: - title: Preview file: app-variation-select-rows-core.py @@ -130,9 +130,9 @@ To make a reactive Data Table, follow three steps: A Data Table can also collect input from the user. To allow this, set `render.DataTable(selection_mode="row")` or `render.DataTable(selection_mode="rows")` to allow the user to select one or more rows of the Data Table. -The indices of the selected rows will be accessible within the server function as a reactive variable returned by `.input_cell_selection()["rows"]`, where is the name of the function decorated with `@render.data_frame`. +The indices of the selected rows will be accessible within the server function as a reactive variable returned by `.cell_selection()["rows"]`, where is the name of the function decorated with `@render.data_frame`. -The value returned will be an empty tuple if no rows are selected, or a tuple of integers representing the indices of the selected rows. To filter a pandas data frame down to the selected rows, use `df.iloc[list(.input_cell_selection()["rows"])]`. +The value returned will be an empty tuple if no rows are selected, or a tuple of integers representing the indices of the selected rows. To filter a pandas data frame down to the selected rows, use `df.iloc[list(.cell_selection()["rows"])]`. For more information about interacting with data frames, see the API documentation for [Express](../../../api/express/express.render.data_frame.qmd) or [Core](../../../api/core/render.data_frame.qmd) syntax. diff --git a/py-shiny b/py-shiny index b75ba6d7..67057884 160000 --- a/py-shiny +++ b/py-shiny @@ -1 +1 @@ -Subproject commit b75ba6d7b0c2c050892b2abe6309b25800f1e552 +Subproject commit 67057884d54919765b66cc554490943edf46490a From c1d87062b0fcdadea6e213cb8a4ebdd1b3496872 Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Thu, 27 Jun 2024 18:38:46 -0500 Subject: [PATCH 2/7] Update Quarto to 1.4.557 (#169) --- .github/workflows/deploy-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 3a00dec9..3c98332c 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -50,7 +50,7 @@ jobs: # ===================================================== - uses: quarto-dev/quarto-actions/setup@v2 with: - version: 1.4.549 + version: 1.4.557 - name: Build site run: | From c3192e5782b0bb142ff9e4071ee69c7be69e4679 Mon Sep 17 00:00:00 2001 From: Joe Schulte Date: Fri, 28 Jun 2024 13:05:36 -0400 Subject: [PATCH 3/7] #155 update id (#170) --- docs/user-interfaces.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-interfaces.qmd b/docs/user-interfaces.qmd index d04ec2fb..8d33d96b 100644 --- a/docs/user-interfaces.qmd +++ b/docs/user-interfaces.qmd @@ -9,7 +9,7 @@ With Shiny, you can create a wide variety of user interfaces (UI), including das Here, we'll use the following dashboard as motivation to learn about some important UI components (e.g., [cards](#cards), [value boxes](#value-boxes)) and layouts (e.g., [columns](#multi-column-layout)). -![A Shiny dashboard with visuals for exploring restaurant tips (see [here](#altogether-now) for the code).](assets/tipping-dashboard.png){class="img-shadow"} +![A Shiny dashboard with visuals for exploring restaurant tips (see [here](#all-together-now) for the code).](assets/tipping-dashboard.png){class="img-shadow"} ::: callout-tip ## More UI design inspiration @@ -207,7 +207,7 @@ Did you know the app viewer above is resizable? Try resizing it to see how the l Tooltips and popovers are a useful means for both displaying and interacting with additional information in a non-obtrusive way. Tooltips are shown on hover, whereas popovers are shown on click, making them more suitable for interactive content like inputs. -In the [actual dashboard](#altogether-now), we'll leverage a popover to effectively add a toolbar with additional inputs controls to card headers. +In the [actual dashboard](#all-together-now), we'll leverage a popover to effectively add a toolbar with additional inputs controls to card headers. ```{shinylive-python} #| standalone: true From b7f7fc0b1e9e647a0f8b652990b31b33d93b7ebe Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Tue, 9 Jul 2024 18:47:26 -0500 Subject: [PATCH 4/7] Abstract out express_core_preview() internals into a app_preview_code() helper so that shiny-dev-center can use it (#172) --- docs/helpers.py | 74 +++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/docs/helpers.py b/docs/helpers.py index 9b5fee6f..f7f561fc 100644 --- a/docs/helpers.py +++ b/docs/helpers.py @@ -207,43 +207,57 @@ def shinylive_app_preview( def express_core_preview( - app_express: str | None = None, - app_core: str | None = None, - files: list[str] | str | None = None, - div_attrs=".shiny-mode-tabset", - group="shiny-app-mode", - language="py", - **kwargs, + app_express: str, + app_core: str, + div_attrs: str = '.shiny-mode-tabset group="shiny-app-mode"', ) -> None: - if app_express is None and app_core is None: - return - - if files is None: - files = [] - elif isinstance(files, str): - files = [files] + app_preview_code( + { + "Express": app_express, + "Core": app_core, + }, + div_attrs=div_attrs, + ) - header_attrs = ".panel-tabset" - header_attrs += " " + div_attrs if div_attrs else "" - header_attrs += f" group='{group}'" if group else "" - block = QuartoPrint(["::: {" + header_attrs + "}"]) +def app_preview_code( + app_files: str | dict[str, str], + files: list[str] | str | None = None, + language: Literal["auto", "py", "r"] = "auto", + div_attrs: str = "", +) -> None: - apps = zip([app_express, app_core], ["Express", "Core"]) + is_tabset = isinstance(app_files, dict) - for app_file, tab_name in apps: - if app_file is None: - continue + if is_tabset: + div_attrs = ".panel-tabset " + div_attrs - sl_app = ShinyliveApp.from_local(app_file, files, language) - lang = "python" if language == "py" else "r" + block = QuartoPrint(["::: {" + div_attrs + "}"]) - block.append("### " + tab_name) - block.append( - f'```{{.{lang} .code-overflow-scroll shinylive="{sl_app.to_url()}"}}' - ) - block.append_file(app_file) - block.extend(["```", ""]) + if not is_tabset: + _add_code_chunk(block, app_files, files, language) + else: + for x in app_files: + block.append(f"## {x}") + _add_code_chunk(block, app_files[x], files, language) block.append(":::") print(block) + + +def _add_code_chunk( + block: QuartoPrint, + file: str, + files: list[str] | str | None = None, + language: Literal["auto", "py", "r"] = "auto", +): + if language == "auto": + language = "py" if file.endswith(".py") else "r" + + sl_app = ShinyliveApp.from_local(file, files=files, language=language) + + lang = "python" if language == "py" else "r" + + block.append(f'```{{.{lang} .code-overflow-scroll shinylive="{sl_app.to_url()}"}}') + block.append_file(file) + block.append("```") From 743b3ab892b8b73e335072bfdcffe647f04a2da4 Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Mon, 15 Jul 2024 14:56:23 -0500 Subject: [PATCH 5/7] Fix link to shinylive examples (#174) * Fix link to shinylive examples * Update docs/overview.qmd Co-authored-by: Garrick Aden-Buie --------- Co-authored-by: Garrick Aden-Buie --- docs/overview.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/overview.qmd b/docs/overview.qmd index 424266c5..fc236a77 100644 --- a/docs/overview.qmd +++ b/docs/overview.qmd @@ -539,7 +539,7 @@ shiny create -t dashboard ## Development workflow See the [workflow](install-create-run.qmd) section for more information developing Shiny apps locally. -Also keep in mind you can develop apps in the browser using the [playground](/playground). +Also keep in mind you can develop apps in the browser using the [playground](https://shinylive.io/py/examples/). ::: From 507b41e87da5d12093dba5c5765e8e274bc6ed84 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 15 Jul 2024 16:19:03 -0400 Subject: [PATCH 6/7] feat: Enable repo-actions (#175) --- _quarto.yml | 3 +++ components/_metadata.yml | 1 + gallery/_metadata.yml | 1 + index.qmd | 1 + layouts/_metadata.yml | 7 ++++--- templates/_metadata.yml | 7 ++++--- 6 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 gallery/_metadata.yml diff --git a/_quarto.yml b/_quarto.yml index be2475cb..0484d6c0 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -62,6 +62,9 @@ website: image-height: 630 card-style: "summary_large_image" + repo-url: https://github.com/posit-dev/py-shiny-site + repo-actions: [issue, edit] + navbar: background: primary foreground: light diff --git a/components/_metadata.yml b/components/_metadata.yml index bd07e269..fda34ee3 100644 --- a/components/_metadata.yml +++ b/components/_metadata.yml @@ -10,3 +10,4 @@ filters: - quarto - line-highlight - shinylive +repo-actions: false diff --git a/gallery/_metadata.yml b/gallery/_metadata.yml new file mode 100644 index 00000000..e21e9fa0 --- /dev/null +++ b/gallery/_metadata.yml @@ -0,0 +1 @@ +repo-actions: false diff --git a/index.qmd b/index.qmd index 51f227e6..c5552f59 100644 --- a/index.qmd +++ b/index.qmd @@ -11,6 +11,7 @@ format: smooth-scroll: true css: - index.css +repo-actions: false --- ::::{.column-screen .mx-auto .pt-0 .mt-0 .pt-xl-5 style="max-width: 1500px;"} diff --git a/layouts/_metadata.yml b/layouts/_metadata.yml index 46e13544..d67c8313 100644 --- a/layouts/_metadata.yml +++ b/layouts/_metadata.yml @@ -1,7 +1,7 @@ sidebar: layouts format: html: - css: + css: - /components/_partials/components.css - _partials/layouts-list.css toc: false @@ -10,5 +10,6 @@ format: filters: - quarto - line-highlight - - shinylive - \ No newline at end of file + - shinylive + +repo-actions: false diff --git a/templates/_metadata.yml b/templates/_metadata.yml index e06076a5..40661728 100644 --- a/templates/_metadata.yml +++ b/templates/_metadata.yml @@ -3,12 +3,13 @@ format: html: template: _partials/gallery-article.template page-layout: article - css: + css: - /components/_partials/components.css - _partials/templates.css toc: false code-line-numbers: false include-after-body: ../components/_partials/componentsjs.html filters: - - shinylive - \ No newline at end of file + - shinylive + +repo-actions: false From 4f87f34e323956b369e1c949b86b0bad56a2d198 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 17 Jul 2024 01:32:59 -0400 Subject: [PATCH 7/7] Update deploy-docs.yml --- .github/workflows/deploy-docs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 3c98332c..241b39c4 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -4,7 +4,6 @@ on: push: branches: [main] pull_request: - branches: [main] jobs: build: