I’m excited to announce that shinywidgets 1.0 is now on PyPI! Grab it now with:
pip install -U shinywidgetsIn principle, shinywidgets lets you use any Jupyter widget library (plotly, altair, and so on) in Shiny. In practice, most widgets are written for one person’s notebook, and many need workarounds before they reliably load, size, re-render, and scale to many concurrent users. In 1.0, dozens of libraries get those workarounds built in, and the failure modes they had in common led to fixes in the logic every widget shares.
Integrations are the bulk of this release, but not all of it. Here are the highlights:
- Support for 40+ libraries, documented on a new website and in an agent skill.
- Reactive accessors that turn common interactions, from a click to a map pan, into reactive values.
- Many fixes and improvements, especially for widgets in deployed, multi-user apps.
If you’re upgrading an existing app, see Upgrading for the few things to check.
A new website#
shinywidgets.org has a guide for every supported library, a gallery of complete apps, and longer guides on everything from choosing a widget to keeping an app fast.
40+ integrations#
Before 1.0, only three libraries had their own decorator.
Everything else went through the generic @render_widget, and often needed extra work to look and behave right.
Now 40+ libraries each get their own decorator (e.g., @render_geolibre), an install extra (e.g., pip install 'shinywidgets[geolibre]'), sizing that fits Shiny’s layouts, and a guide with runnable examples.
The table below groups them by what you’re building, and each name links to its guide.
| Category | Libraries |
|---|---|
| Charts | plotly, altair, bokeh, matplotlib, plotnine, bqplot, HoloViews (with hvPlot, GeoViews, and datashader), jupyter-scatter, Observable Plot, Panel |
| Maps & geospatial | ipyleaflet, leafmap, MapLibre, lonboard, GeoLibre, kepler.gl |
| Tables & grids | itables, reactable, ipydatagrid, Perspective |
| Data exploration | PyGWalker, quak, Mosaic, Embedding Atlas |
| 3D | k3d, pythreejs, PyVista, ipyvolume |
| Scientific | mols2grid, nglview, vizarr, NiiVue, ipyaladin, Rerun |
| Networks | ipycytoscape, ipysigma |
| Input & drawing | drawdata, ipycanvas, ipyfilechooser |
It may still work.
@render_widget renders any ipywidget, including anywidget-based ones you write yourself.
I can’t test every widget out there — if yours doesn’t work, please let me know.
Gallery#
The site has a gallery of complete apps, and its home page features six of them. This video steps through each one, showing the app as it loads and then after a click, lasso, or brush:
Those are just the highlights — visit the gallery for all 18 complete apps and 17 smaller templates, each with source code.
Guides#
- New to shinywidgets? Start with Why shinywidgets? and Your first widget app, which runs in your browser via Shinylive.
- Choosing a widget compares libraries by task and data size.
- Linking widgets covers eight patterns for making widgets react to each other.
- Updating in place changes a widget without re-rendering it, keeping the user’s zoom and shrinking a plotly recolor from 5.5 MB to 36 KB.
- Large data & performance benchmarks three ways to scale to millions of points.
- AI exploration pairs widgets with an LLM chat that can read and drive them.
- Any widget covers libraries without their own decorator, and writing your own.
For your coding agent#
Most of shinywidgets 1.0 is newer than what coding agents were trained on. So the package ships an Agent Skill: the guides and widget pages above, condensed for agents and matched to the version you have installed. To try it, paste this into your coding agent. It sets up a project, installs the skill, brainstorms app ideas with you, then builds one:
Help me build a Shiny for Python app with linked, interactive widgets
using shinywidgets.
1. Set up: create a uv project (`uv init`, `uv add shinywidgets`), then
run `uvx library-skills -s shinywidgets --yes` (add `--claude` if
you're Claude Code) and read the skill it installs.
2. Brainstorm with me: ask what data I have (or suggest an interesting
public dataset) and what I want to learn from it, one question at a
time. Then pitch three app ideas where widgets react to each other,
at least one using a library I probably haven't tried.
3. Build it: once I pick one, install the extras it needs, build the
app, run it in the background, and give me the URL and what to click
first.Reactive accessors#
Rendering a widget hasn’t changed.
A @render_* function returns whatever you’d show in a notebook, and users get a widget they can click, hover, select, pan, and so on:
df = px.data.gapminder().query("year == 2007")
@render_plotly
def plot():
return px.scatter(df, x="gdpPercap", y="lifeExp", log_x=True)Doing something with those interactions in a larger app can be challenging.
That’s because some interactions fire callbacks (e.g., on_click()), others update a synced property (e.g., an ipyleaflet map’s bounds), and each widget has its own APIs to learn.
The new reactive accessors API in 1.0 aims to unify and simplify how you work with widget interactions.
They behave much like any other Shiny input and aim to be as consistent as possible across widgets.
For instance, plot.selected() reactively reads what the user selected on a plot, and is available for plotly, altair, bokeh, and more. For a full list of accessors, see the accessor cheat sheet.
Since accessors are methods, they can also provide documentation and type hints, making it easier to understand how to use them and what data they return. Reactive accessors also handle the fiddly parts of event handling, like debouncing rapid interactions, firing on repeat clicks, and keeping values across a re-render.
To get a feel for them, here are a few examples, each turning an interaction into something else in the app.
Lasso to table#
With selection reporting turned on via @render_plotly(listen_to=), plot.selected_rows(df) returns the rows of your data frame that the user lassoed.
from shiny.express import render
@render_plotly(listen_to=["selected_rows"])
def plot():
fig = px.scatter(df, x="gdpPercap", y="lifeExp", log_x=True, custom_data=[df.index])
return fig.update_layout(dragmode="lasso")
@render.data_frame
def selected():
return plot.selected_rows(df)
@render_plotly also has .clicked(), .hover(), .relayout(), and more, borrowed from event_data() in the R plotly package, which I also maintain.
Reacting to widgets covers them all.
Map to chart#
Next, an ipyleaflet map of Montreal car-share pods drives a plotly histogram of just the pods currently in view, so panning or zooming the map updates the chart.
# pods: plotly's carshare data, with a "period" column for each pod's busiest time of day
@render_ipyleaflet
def pod_map():
... # an ipyleaflet Map with a marker for every pod
@render_plotly
def in_view():
(south, west), (north, east) = pod_map.bounds()
visible = pods[pods.centroid_lat.between(south, north) & pods.centroid_lon.between(west, east)]
return px.histogram(visible, x="period")
Selection to chat#
Accessors can be read from any code, including a tool that an LLM calls.
Below, a chatlas client gets a tool that returns the countries lassoed on the plot above, and a shinychat Chat passes along the user’s questions.
def get_selection() -> str:
"""The countries the user lassoed on the scatter plot."""
with reactive.isolate(): # temporary workaround to read reactive state in a tool call
rows = plot.selected_rows(df)
return rows[["country", "gdpPercap", "lifeExp"]].to_csv(index=False)
client = chatlas.ChatAnthropic()
client.register_tool(get_selection)
chat = Chat("chat", client=client)In the screenshot below, I lassoed the handful of countries sitting well below the curve and asked why. The model called the tool to find out which countries I meant, then explained the gap using things it knows that aren’t in the data, like HIV/AIDS and oil and diamond wealth that never reaches most people.
Tools can go the other direction too.
One that sets map.widget.center lets the model move a map when asked.
AI exploration has examples of both.
Any widget#
Widgets without their own decorator don’t get named accessors, but under @render_widget, .read() reactively reads any synced property, so even a custom anywidget can drive the rest of your app.
@render_widget
def spark():
return Sparkline(values=data) # a custom anywidget
@render.code
def clicked():
return spark.read("clicked_index")Linking widgets has more patterns like these.
Many improvements#
Besides the new decorators and accessors, 1.0 fixes a lot of long-standing rough edges. Most of these fixes help every widget, including ones without a dedicated decorator.
Widgets that render right#
- More nested widgets render. Some widgets nested inside other widgets, like a plotly chart in an ipyleaflet popup, didn’t render at all, and others, like leafmap legends, rendered while logging errors. A newer version of the JavaScript that renders Jupyter widgets fixes both, along with widgets built on ipyreact and icon fonts like FontAwesome.
- Widgets fit your layout. They fill their container in filling layouts (e.g., a card), respect an explicit
output_widget(height=...), and keep any size you set on the widget itself. That also fixes cases where a plot collapsed to a sliver or ignored the height you gave it. Some widgets, like ipydatagrid and bqplot, follow the app’s dark mode too. Layout & theming has the details. - Fewer silent failures. A widget that breaks after its render function returns now shows an error instead of a blank output, and exceptions in handlers like
on_click()reach the server log. Widget methods called before the output finishes rendering, like k3d’sstart_auto_play(), are no longer dropped.
Apps with many visitors#
Jupyter widgets were designed for notebooks, which usually means one person with one kernel on their own machine. With Shiny, one Python process can serve many visitors at once, user sessions come and go, and the app may run for weeks.
- Each visitor gets their own state.
@render_matplotlib, for example, keeps pyplot’s global state separate per session. Returning a widget that belongs to another session now raises a clear error, andsession_lifetime()andshared_lifetime()let you cache or share a widget when you mean to. - Memory is freed sooner. Re-rendering, hiding, or removing an output could leave the old widget, and the data it held, in memory until the session ended. Those cases are fixed on both the server and in the browser, so widgets are freed as soon as they’re replaced or removed.
- One oversized message no longer disconnects a visitor. It’s dropped with a notification instead.
- Widgets that assumed a local machine work on a server. localtileserver raster layers load on Posit Connect and shinyapps.io with no extra code, and widgets that run SQL from the browser (quak, Mosaic, Embedding Atlas) are blocked from reading the server’s files by default. Deployment covers the rest.
Other improvements#
- Clearer errors for things that aren’t widgets. Returning something that can’t be rendered as a widget, like a string, now gets a clearer error message.
- Plotly config options.
@render_plotlynow accepts a Dash-style(fig, config)return value, for Plotly.js config options like hiding the toolbar with{"displayModeBar": False}. - Bokeh assets load automatically, including those for extension models and in apps mounted under a URL prefix, so you no longer need
bokeh_dependency()in your UI. - Updates from background threads arrive right away. With shiny 1.9, widget updates made from a background thread (e.g., nglview’s, or your own
threading.Thread) reach the browser right away instead of waiting for the visitor’s next input.
The changelog has the full list.
Upgrading#
Most apps should upgrade without changes.
shinywidgets 1.0 requires shiny 1.9 and ipywidgets 8.1, plus plotly 5.12 if you use plotly.
The one change most likely to affect an existing app is that @render_plotly no longer sends plotly’s own click, hover, and selection events to Python unless the app uses them.
If a plotly callback registered outside the render function stops firing, turn them back on with shinywidgets.config(native_events=True).
The changelog lists every breaking change and deprecation.
Thanks, and what’s next#
In a lot of ways, shinywidgets 1.0 is a celebration of other people’s work, from the 40+ libraries above to projects like anywidget that make new widgets easy to write. Thank you to everyone who built them, and especially to the maintainers who welcomed fixes and reports from upstream: @manzt (anywidget), @giswqs (GeoLibre), @koaning (drawdata), @texodus (Perspective), @philippjfr (Panel), and @juba (pyobsplot).
If a library you rely on doesn’t have its own decorator yet, you can help! The repo includes an agent skill for adding integrations that takes a coding agent from “does this widget even work?” to a decorator, sizing, accessors, and a guide, checking each step in a real browser. Each new integration can surface another failure mode in the logic every widget shares, so Pull Requests are very welcome, and so is an Issue that just says what didn’t work.
So go bring your Jupyter widgets to Shiny, and if you build something neat, I’d love to see it! You can find me on socials via my profile page.




