Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Single widget manager per kernel #3922

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

fleming79
Copy link

@fleming79 fleming79 commented May 27, 2024

Replaces #3920.

Features:

  • Widgets can render anywhere the WidgetRenderer can be accessed (anywhere the global rendermime or clones work).
  • Correctly indicates when comms is disconnected.
  • Re-renders widgets when comms is restored.
  • Easier to manage and find widgets - the KernelWidgetManager.

Significant changes

  • The KernelWidgetManager is a single instance per kernel by the kernel ID.
  • The KernelWidgetManager stores and creates widgets.
  • The default rendermime will actively search for the [Kernel]WidgetManager that owns the widget model.
  • WidgetManager (not to be confused with KenelWidgetManager) has been re-purposed to track the renderers belonging to a session context and set the KernelWidgetManager when the kernel is loaded. WidgetManager informs the renderer that the [Kernel]WidgetManager is pending.
  • Re-rendering on demand.

Notebooks and Consoles can share widgets

image

When the notebook is closed ipwidgets takes over comms and re-renders the widget.

image

Shutting down the kernel breaks the connection (note the red paper clips)

image

Re-opening the notebook now gives a message

Model not found for this kernel: AppLayout(children=(HTML(value='<h1>Fictional World Weather</h1>', layout=Layout(grid_area='header', height='a…

image

Copy link

Binder 👈 Launch a binder notebook on branch fleming79/ipywidgets/per-kernel-widget-manager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant