SciPy 2024

Bring your __repr__’s to life with anywidget
07-09, 08:00–12:00 (US/Pacific), Room 317

Jupyter Widgets connect Python objects with web-based visualizations and UIs, enabling both programmatic and interactive manipulation of data and code. For example, lasso some points in a scatterplot visualization and access that selection in Python as a DataFrame.

anywidget makes it simple and enjoyable to bring these capabilities to your own Python classes, and it ensures easy installation and usage by end users in various environments. In this tutorial, you will create your own custom widgets with anywidget and learn the skills to be effective in extending your own Python classes with web-based superpowers.


Description

Jupyter Widgets enrich notebooks with interactive web-based views and controls for Python objects in the Jupyter kernel. They enable users to interact more deeply with their programs and explore data. Consider a machine learning researcher adjusting model parameters with a slider or a computational biologist navigating a genome browser programmatically. Widgets also bring modern browser features to Python, such as high-performance graphics rendering with WebGL and cutting-edge WebGPU, controlling serial devices via WebSerial, and numerous other Web APIs.

anywidget simplifies creating and sharing custom Jupyter Widgets, enabling you to extend your own Python classes with rich, interactive visualizations and UIs. It modernizes widget development, making authoring custom widgets more accessible, reliable, and enjoyable. For end users, anywidget ensures that custom 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.

This tutorial is aimed at intermediate Python tinkerers keen on experimenting with interactive tools and seasoned library developers seeking to introduce interactive features to their libraries for end users. Prior web experience is not required for this tutorial, but a basic understanding of HTML, CSS, and JavaScript will help you get the most out of it.

Topics

Our goal is to get you programming and confident in authoring anywidgets of your own. We will cover:

  • Widgets from a Python and browser perspective. We'll start with how widgets extend regular Python objects with web-capabilities, then look at how Python and the front-end communicate.

  • Just Enough JavaScript™. You will learn modern fundamentals, skipping legacy information and tooling that often leaves a negative impression of the language. We'll cover essential web platform concepts for effective Python communication, providing a universal foundation for building cross-platform visualizations and UIs.

  • Hands-on anywidget. The bulk of the tutorial will focus on hands-on examples of building custom Jupyter Widgets with anywidget. We'll begin by prototyping basic examples in notebooks and transition to more advanced use cases. Patterns such as 2-way data bindings, importing front-end libraries, custom serialization, and sending binary data will be covered.

  • Q/A and/or advanced topics. Options include exploring the widgets ecosystem or discussing advanced topics like packaging and publishing. Alternatively, we can assist individuals with their personal projects or collaborate on an idea together; please contact the us in advance with your idea so we can plan accordingly!

Learning Goals

Attendees will leave with an understanding of how Jupyter Widgets work and the confidence to start creating and deploying anywidgets in their everyday work.


Prerequisites

Attendees should have basic understanding of:

  • Python: imports, if statements, for loops, function definitions, class definitions, and return statements
  • Python environments: ability to create a new environment for the tutorial
  • Jupyter notebooks: launch a notebook, code in cells, and execute code
  • Python data science libraries: basic knowledge of both NumPy arrays, Pandas DataFrames
  • JavaScript: if statements, for loops, function definitions, arrow functions, and return statements, and the async keyword. No need to be an expert! We will cover importing/exporting modules and dependencies.
  • DOM: basic understanding of the Document Object Model (DOM) and how it can be manipulated by JavaScript.
Installation Instructions

https://github.com/manzt/scipy-2024-anywidget

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:

I am an Assistant Professor in the Department of Genomics and Computational Biology and the Department of Systems Biology at UMass Chan Medical School.

I lead a computational research group (https://abdenlab.org) with a dual mandate. My group's biological research focuses on the 3D organization of the genome (3C/Hi-C technologies), its relationship to the epigenome, and the resulting manifold influences on cellular fate, differentiation, aging, and disease. My group's open-source interests are in supporting foundational software infrastructure to improve genomic and multi-omic data science, especially in the scientific Python ecosystem.

Fritz Lekschas is a computer scientist researching scalable visual exploration of biomedical data. As the Head of Visualization Research at Ozette Technologies, he is leading the development of web-based data visualization and exploration tools for analyzing high-dimensional single-cell data. Fritz earned his PhD in computer science from Harvard University, where he was advised by Hanspeter Pfister and Nils Gehlenborg. He has published more than twenty peer-reviewed papers and his work has been recognized with several awards.

In his free time, Fritz likes to work on open-source tools for visual data exploration like Jupyter Scatter.