I want to share a small library I developed that allows interaction with
ipywidgets inside lab or notebook environments while executing a long-running cell.
So why is it needed?
This behaviour is often desirable however. In geospatial applications in particular selecting a region on a map at the start of the notebook, then running the rest, is a commonly requested feature. While this is possible to achieve with current tools, the experience is a bit sub-par, as it requires instructing the notebook user to not execute subsequent cells until desired input is provided.
I wanted to be able to write notebooks that use highly interactive user inputs, like
ipyleaflet, while still maintaining a typical linear workflow. And I wanted to be able to run those notebooks with
Run All without any issues.
While researching on how to achieve this I came across
ipython_blocking library that addresses similar issue. Ultimately it did no quite suit my needs, but it did provide a starting point for my own implementation, so I thought it’s important to reference it.
You can install it with
pip install jupyter-ui-poll
Or play with it in binder.