marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
7.8k stars 274 forks source link

GUI Event Loop integration #1986

Open akshayka opened 3 months ago

akshayka commented 3 months ago

Description

GUI libraries such as napari rely on IPython's opt-in integration with GUI event loops to render and respond to user interactions.

We currently have no support for integrating with GUI event loops.

Suggested solution

Provide integrations with GUI event loops, and let third-party libraries start these event loops.

Alternative

No response

Additional context

Documentation on IPython's GUI event loop: https://ipython.readthedocs.io/en/stable/config/eventloops.html#integrating-with-gui-event-loops

Napari's documention on the GUI event loop: https://napari.org/stable/guides/event_loop.html#in-ipython-or-jupyter-notebook

IPython kernel's event loop integration: https://github.com/ipython/ipykernel/blob/main/ipykernel/eventloops.py

pavanramkumar commented 2 months ago

I love what you've built with marimo.

One of the reasons I'm holding back from switching over fully to marimo is a feature like this. I use napari currently and can't seem to launch a new qt session from a marimo cell:

napari.view_image(img_array)

doesn't really do anything.

Is this feature on the roadmap?