Observable in Jupyter

@thomasballinger created a very nice document on how to incorporate observable inside of jupyter-based notebooks (e.g. Google Colab, Kaggle). I am able to use the “embed” within Colab and run observable notebooks in cells. Is it possible to go down deeper in Colab to use the fantastic interactive controls and displays common in Observable, but at the Python variable level in Colab? There is not much interaction within Colab, but recently there was Javascript work to select points on a plot, interactively. I hang out mostly in the machine learning arts, where Colab is the go-to tool.

Do you mean like, you want to have a slider in Observable, and then use the value of the slider in Python?

Tom’s done a few versions of Jupyter integrations; his latest is GitHub - thomasballinger/observable-jupyter-widget. I haven’t tried it, but it sounds like it does what you’re looking for — you can pass Python variables into the widget, and get values back out:

Widgets have a .value attribute which is a dictionary of values from Observable cells.

print(w.value)

Here is the issue in a nutshell. Observable notebooks have a set of fantastic interactive controls and displays mainly because it is Javascript-based. In sharp contrast, Python notebooks in Google Colab tend to be dry and devoid of interaction and visualization. So, my goal is to know whether Observable can come to the rescue. I’ll relook at the links you mentioned, so thanks!

I tried one of Tom’s notebooks, but it mainly used “embeds” to embed a notebook in Observable within Colab’s interface. I am seeking something more lower level to where I can code completely in Python (in a Colab notebook) but leverage Observable to make Colab python notebooks more interactive. Maybe widgets are the answer.