SciPy 2024

anywidget: custom Jupyter Widgets made easy
07-11, 15:50–16:20 (US/Pacific), Room 316

Visualization plays a critical role in the analysis and decision making with data, yet the manner in which state-of-the-art visualization approaches are disseminated limit their adoption into modern analytical workflows. Jupyter Widgets bridge this gap between Python and interactive web interfaces, allowing for both programmatic and interactive manipulation of data and code. However, their development has historically been tedious and error-prone.

In this talk, you will learn about anywidget, a Python library that simplifies widgets, making their development more accessible, reliable, and enjoyable. I will showcase new visualization libraries built with anywidget and explain how its design enables environments beyond Jupyter to add support.


Jupyter Widgets connect Python objects with web-based visualizations and UIs, enabling both programmatic and interactive manipulation of data and code. Custom widgets enable domain experts to design and use web-based interactive data exploration and visualization during analysis. However, their development has historically been tedious and error-prone.

anywidget simplifies creating and sharing custom Jupyter Widgets, enabling the extension of Python classes with rich, interactive visualizations and UIs. It modernizes widget development, making custom widgets more accessible, reliable, and enjoyable to create. For end users, anywidget ensures that widgets are easy to install and use in a variety of interactive computing environments (e.g., Jupyter Notebooks, JupyterLab, VS Code, Google Colab, etc), dashboard frameworks (e.g., Panel, Shiny, Solara, etc), and even standalone HTML. For library developers and hackers, it offers a gateway to bring modern browser features to Python, such as WebGL/WebGPU for graphics, WebSerial for device control, and many more Web APIs.

anywidget is not a new widgets framework, but rather an abstraction around Jupyter Widgets using the browser’s native module system. A consequence of this design is that it drastically lowers the barrier to entry for many potential widget developers and improves the overall development experience. Prototype directly within notebooks and gradually transition widgets into pip-installable packages–just like regular Python programs. Since anywidget controls the loading and execution of the widget code, we further integrate with Jupyter during development to watch for file changes and push updates to the front end, providing a “live” editing experience entirely from within Jupyter.

Since its release, anywidget has seen increasing adoption, replacing the older cookiecutter template for widget creation. This transition marks a new phase in widget development, resulting in the emergence of more visualization libraries and the integration of anywidget into notable projects like Altair. Its binary data transfer capability has also enabled several new visualization libraries to render large data sets on the GPU, marking a shift towards high-performance interactive visualization applications powered by the Python data stack.

In this talk, I will share how anywidget started as a small personal project to help me as a visualization researcher and evolved into a broader community effort. I will focus on its design principles, how they differ from traditional widgets, and how they enable modern development features and broader compatibility beyond Jupyter. I will show how anywidget simplifies widget development, focusing on prototyping and “live” editing features. We will also look at the growing ecosystem around anywidget, highlighting community projects that demonstrate its performance capabilities. Finally, we will touch on where and how widgets can be used. Python developers seeking to build interactive visualizations will leave this talk with concrete ideas and practical knowledge on what and how to create them. Python users will gain a clearer understanding of how to incorporate interactive widgets into their existing workflows and explore the diverse applications they enable.

Hi, I'm Trevor 👋 I'm a PhD student and visualization researcher in the HIDIVE Lab at Harvard Medical School. I build interactive visualization tools for computational biologists to analyze data more effectively.

I want to make the web platform more accessible to Python developers and help data scientists bring interactive visualizations in their workflows. I maintain anywidget and am involved in the Zarr community. Last year was my first SciPy and I'm very excited to be returning.

This speaker also appears in: