Registry / web-framework / shinywidgets

shinywidgets

JSON →
library0.8.1pypypi✓ verified 91d ago

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 shinywidgets
INSTALL
IMPORT
SIG · SHINYWIDGETS
S
shinywidgets
web-frameworkpythonv0.8.1
Install
10.5s avg
Import
2704ms
Disk
144MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.8.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 2.844s · 149.5MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 10.5s · import 2.563s · 149MB
144MB installed
● package 144MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

output_widget
✓ from shinywidgets import output_widget
render_widget
✓ from shinywidgets import render_widget

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.

from shiny import App, ui, render from shinywidgets import output_widget, render_widget import ipywidgets as widgets app_ui = ui.page_fluid( ui.h2('Shiny + ipywidgets'), output_widget('my_slider'), ui.output_text('slider_value'), ) def server(input, output, session): @render_widget def my_slider(): return widgets.IntSlider(min=0, max=100, value=50, description='Slider:') @output @render.text def slider_value(): return f'Slider value: {input.my_slider()}' app = App(app_ui, server)
Debug
Known issues
gotchaWidgets initialized inside a `reactive.effect()` are no longer automatically removed when the effect invalidates. This change requires manual management of widget lifecycle if automatic cleanup was previously relied upon.
fix
If automatic cleanup is required, consider re-evaluating widget initialization placement or explicitly managing the widget's lifecycle with `widget.close()` within the effect.
affects: >=0.6.0
breakingFor `altair` and `plotly` integrations, `anywidget` is now a direct dependency and must be installed separately. Additionally, `plotly` versions prior to 6.0.0 might be incompatible.
fix
Ensure you `pip install anywidget` and, if using Plotly, `pip install plotly>=6.0.0`.
affects: >=0.5.0
gotcha`anywidget`-based widgets (e.g., Plotly, Altair) may fail to initialize or update correctly with `websockets` versions 16.0 or higher due to a fix introduced in `shinywidgets` v0.7.1.
fix
Upgrade `shinywidgets` to version `0.7.1` or newer (`pip install --upgrade shinywidgets`).
affects: <0.7.1
gotchaIn `shinywidgets` versions before 0.7.2, widget cleanup might not occur correctly if the widget was created inside a render output's context that differs from the current context, potentially leading to resource leaks or unexpected behavior.
fix
Upgrade `shinywidgets` to version `0.7.2` or newer (`pip install --upgrade shinywidgets`) to ensure proper widget cleanup.
affects: <0.7.2
Errors
Common errors & fixes
AttributeError: object has no attribute '_repr_mimebundle_'
This error occurred in `shinywidgets` versions prior to 0.5.1 due to an internal handling issue with widget representation, particularly with certain `ipywidgets`.
fix
Upgrade `shinywidgets` to version `0.5.1` or higher: `pip install --upgrade shinywidgets`.
Plotly graph not rendering or failing to update in Shiny app.
Common causes include missing `anywidget` dependency, an outdated `plotly` version (pre-6.0.0), or incompatibility with `websockets>=16.0` in `shinywidgets < 0.7.1`.
fix
Ensure `pip install anywidget plotly>=6.0.0` and `pip install --upgrade shinywidgets` (to at least v0.7.1) are executed.
ipyleaflet erroring out when attempting to read the .model_id property of a closed widget object.
This issue was specific to `ipyleaflet` integration in `shinywidgets` versions prior to 0.5.0, related to how closed widget objects were handled.
fix
Upgrade `shinywidgets` to version `0.5.0` or higher: `pip install --upgrade shinywidgets`.
Upgrade
Version history
0.8.1latest on PyPI · released May 6, 2026
Audit
Dependencies
shinyrequiredCore framework for building applications.
ipywidgetsrequiredThe underlying interactive widget framework.
anywidgetoptionalRequired for `altair` and `plotly` integrations since `shinywidgets` v0.5.0.
Agent activity
12 hits · last 30 days
node
10
Resources
shinywidgets — pip install shinywidgets · libregistry