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

Panel widget event triggers are not working in py:percent notebooks #1198

Open
ruzzle opened this issue Dec 19, 2023 · 2 comments
Open

Panel widget event triggers are not working in py:percent notebooks #1198

ruzzle opened this issue Dec 19, 2023 · 2 comments

Comments

@ruzzle
Copy link

ruzzle commented Dec 19, 2023

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:

recording

I first thought it may be a panel issue, so I filed a Github issue there (see holoviz/panel#6050), though during troubleshooting it later on appeared as if it has more to do with triggering events in general.

@ruzzle ruzzle changed the title Panel interactivity are not working in py:percent notebooks Panel widgert event triggers are not working in py:percent notebooks Dec 19, 2023
@ruzzle ruzzle changed the title Panel widgert event triggers are not working in py:percent notebooks Panel widget event triggers are not working in py:percent notebooks Dec 19, 2023
@maximlt
Copy link

maximlt commented Dec 21, 2023

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.

@mahendrapaipuri
Copy link
Contributor

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?

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

No branches or pull requests

3 participants