Open ruzzle opened 9 months ago
Thanks for opening an issue here too @ruzzle. I'm a Panel contributor and very briefly looked into this issue but couldn't identify where the problem might be, either in Panel/pyviz_comms or in jupytext or in how they interact with each other.
I took a quick look at it and the problem is in registering pyviz_comm
extension. There we are registering the extension only with Notebook
widget factory. Jupytext registers its own widget factory Jupytext Notebook
when loading its frontend extension. So, for the panel callbacks to work, we need to register the pyviz_comm
extension with Jupytext widget factory as well.
As a quick test I added like app.docRegistry.addWidgetExtension('Jupytext Notebook', nb_extension);
to register the pyvoz_comm
extension and it worked. The callbacks fire from jupytext
notebooks as well just like in vanilla notebooks.
There is a widgetFacory
iterator that we can use to iterator over all available widget factories and check the factories that provide notebook
type widgets and then register the pyviz_comm
extension with those widget factories? The one thing I am not sure with this approach is what happens if jupytext
has not registered its factory when pyviz_comm
is registering its extension. Any ideas?
I am running jupyter lab via the latest official Jupyter docker “minimal-notebook” image, i.e “jupyter/minimal-notebook”. Within this environment, I am using py:percent notebooks via Jupytext for version control purposes.
I am playing with the Tabulator widget of panel in a py:percent notebook and have added an on_click event trigger, printing something. When I open the notebook as a "Jupytext notebook", the event trigger fails to work. When I open the notebook as a "Notebook", the event trigger works.
See the below recording to see the difference:
I first thought it may be a panel issue, so I filed a Github issue there (see https://github.com/holoviz/panel/issues/6050), though during troubleshooting it later on appeared as if it has more to do with triggering events in general.