metakernel icon indicating copy to clipboard operation
metakernel copied to clipboard

ipywidgets 7.x change comm manager and channel names

Open morlic opened this issue 1 year ago • 2 comments

Metakernel creates a new CommManager which is incompatible with jupyter widgets where a global singleton CommManager is used. In addition, the comm channel name was changed from ipython.widget to jupyter.widget and jupyter.widget.control was added.

https://github.com/Calysto/metakernel/blob/main/metakernel/_metakernel.py#L155

The correct comm registration (based on IPythonKernel) is:

    self.comm_manager = comm.get_comm_manager() # Do not create a new comm manager, the rest of the system uses a singleton
    comm_msg_types = ["comm_open", "comm_msg", "comm_close"]
    for msg_type in comm_msg_types:
        self.shell_handlers[msg_type] = getattr(self.comm_manager, msg_type)

    import ipywidgets as widgets
    widgets.register_comm_target() # Does the registration on behalf of ipywidgets

I'll see if I'll have time for a pull request :)

morlic avatar Nov 14 '24 10:11 morlic

jupyter commit - https://github.com/martinRenou/ipywidgets/commit/a284fd47c9c472dbe20d9c5f635e75270dcb66f6

morlic avatar Nov 14 '24 10:11 morlic

@morlic thanks for the note, and possible PR :)

dsblank avatar Nov 14 '24 10:11 dsblank