ipywidgets

Interactive HTML widgets for Jupyter notebooks

Library
PyPI
v8.1.9
3,326stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
85/100Excellent
Development Activity88
Maintenance60
Community92
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture76
Code Quality74
Innovation70
Learning Curve68

ipywidgets is the Python package for building interactive, stateful HTML widgets in Jupyter notebooks and JupyterLab — sliders, dropdowns, text boxes, buttons, progress bars, and layout containers that render as live browser DOM elements and stay synchronized with Python variables via the Jupyter comm/messaging protocol.

It is the Python half of the broader Jupyter Widgets ecosystem (developed in the same monorepo alongside the TypeScript @jupyter-widgets packages and the widgetsnbextension/jupyterlab_widgets front-end integration packages), and forms the foundation that higher-level dashboarding and visualization tools (bqplot, ipyleaflet, ipyvolume, voila) build their own custom widgets on top of.

What You Get

  • A library of built-in widgets — sliders, text/number inputs, dropdowns, checkboxes, buttons, progress bars, tabs, accordions, and output areas
  • Two-way data binding between Python traitlets attributes and the rendered browser widget via link()/jslink()
  • interact()/interactive() decorators that auto-generate a UI from a function’s arguments
  • Layout and styling primitives (Box, HBox, VBox, Layout) for composing widgets into dashboards
  • embed.py utilities to export a notebook’s widget state as standalone, static HTML
  • A documented protocol/schema (state.schema.json, view.schema.json) for building custom third-party widgets

Common Use Cases

  • Adding interactive sliders, dropdowns, and buttons to a Jupyter notebook to explore data or model parameters live
  • Building lightweight, notebook-native dashboards without leaving the Python/Jupyter environment
  • Auto-generating a quick interactive UI for a function’s parameters via interact()
  • Serving as the widget foundation for domain-specific interactive libraries (maps, plots, 3D visualization) built on the same protocol

Under The Hood

Architecture - each widget is a Python Widget subclass (built on traitlets) whose observable attributes are serialized and pushed over a Jupyter kernel comm channel to a matching Backbone/TypeScript model in the front end (defined in the sibling packages/base, packages/controls, and packages/output TypeScript packages in the same monorepo); embed.py walks a notebook’s live widget state graph and serializes it into static HTML+JS for export, while comm.py implements the low-level message-passing layer. Tech Stack - the Python package (python/ipywidgets/) depends on traitlets, ipython, and comm, and is developed alongside the front-end TypeScript packages (packages/base, packages/controls, packages/output, packages/schema) built with a Lerna-managed yarn workspace; widgetsnbextension and jupyterlab_widgets are companion packages that install the front-end assets into classic Notebook and JupyterLab respectively. Code Quality - the Python package has a dedicated tests/ directory covering widget serialization, trait validation, and the interact-decorator behavior, complemented by a separate ui-tests/ Playwright suite exercising the rendered widgets in a real notebook front end — a two-layer testing strategy reflecting the project’s split between Python state and browser rendering. API Design - the core design goal is that defining a new widget requires only declaring traitlets attributes on a Python class, with the state-sync protocol (documented via JSON schema) handling front-end rendering; interact() pushes this further by inferring an entire UI from a plain function signature, prioritizing minimal boilerplate for the common case over fine-grained control.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search