shinywidgets facilitates the rendering and interactive use of `ipywidgets` within `Shiny for Python` applications. It bridges the gap between the rich interactive capabilities of `ipywidgets` and the reactive framework of Shiny, allowing users to embed existing widget ecosystems like `ipyleaflet`, `plotly.graph_objects.FigureWidget`, and `ipyvolume` directly into their Shiny apps. The current version is 0.8.0, with a fairly active release cadence, often addressing compatibility with new versions of `ipywidgets`, `plotly`, and `websockets`.
pip install shinywidgetsVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to integrate an `ipywidgets.IntSlider` into a Shiny application. The `output_widget` function creates a placeholder in the UI, and the `@render_widget` decorator on the server side defines the `ipywidget` to be rendered. The widget's value can be accessed via `input.widget_id()` just like standard Shiny inputs.
If automatic cleanup is required, consider re-evaluating widget initialization placement or explicitly managing the widget's lifecycle with `widget.close()` within the effect.
Ensure you `pip install anywidget` and, if using Plotly, `pip install plotly>=6.0.0`.
Upgrade `shinywidgets` to version `0.7.1` or newer (`pip install --upgrade shinywidgets`).
Upgrade `shinywidgets` to version `0.7.2` or newer (`pip install --upgrade shinywidgets`) to ensure proper widget cleanup.
Upgrade `shinywidgets` to version `0.5.1` or higher: `pip install --upgrade shinywidgets`.
Ensure `pip install anywidget plotly>=6.0.0` and `pip install --upgrade shinywidgets` (to at least v0.7.1) are executed.
Upgrade `shinywidgets` to version `0.5.0` or higher: `pip install --upgrade shinywidgets`.