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

Optional dependency on ipykernel #3209

Open
martinRenou opened this issue Jun 9, 2021 · 1 comment
Open

Optional dependency on ipykernel #3209

martinRenou opened this issue Jun 9, 2021 · 1 comment

Comments

@martinRenou
Copy link
Member

martinRenou commented Jun 9, 2021

Problem

ipywidgets currently depends on ipykernel to get access to the Comm implementation and a couple of other goodies. But it becomes clear that ipywidgets could be used in other contexts than ipykernel, either from another "classic" Python kernel like xeus-python (see related issue jupyter-xeus/xeus-python#342) or from "front-end" kernels like Pyodide (see related issue https://github.com/jtpio/jupyterlite/issues/18).

The current way xeus-python deals with this is by monkey patching the ipykernel module to inject its own Comm class that forwards messages through the xeus communication.
Something similar could be done for Pyodide, but we are facing the problem that ipywidgets depends on ipykernel which itself depends on system libraries like "termios" which cannot be installed on the front-end (see https://github.com/jtpio/jupyterlite/issues/18#issuecomment-854030491).

Note that ipywidgets might not be the right place to open this issue, as it's not the only library making use of Comms.

Proposed Solution

It would be nice to have an optional dependency on ipykernel for now. And on the long term find another way of importing the Comm class. One way to do that could be through entry points (but are entry points supported by Pyodide?).

Additional context

jupyter-xeus/xeus-python#342
https://github.com/jtpio/jupyterlite/issues/18

@jtpio
Copy link
Member

jtpio commented Jun 9, 2021

Thanks Martin for opening this 👍

xref pyodide/pyodide#1598 where this was also briefly discussed.

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

2 participants