pyodide-kernel
pyodide-kernel copied to clipboard
Missing pyodide attributes `js.document` and `js.window`
Description
Current pyodide stays on version v0.20.0, which should support js.window or js.document following the pyodide doc.
However, I cannot use them in jupyterlite.

Use pyodide REPL:

Thanks @qqdaiyu55 for opening this.
In JupyterLite the Pyodide-based kernel runs in a Web Worker instead of the main thread. Which means some of the APIs and access to the DOM are not directly supported, although some projects like Comlink could help with this.
In theory it's possible to implement a custom JupyterLite kernel that would run Pyodide in the main thread and would give access to document and window, However this is likely not going to be supported by default in core JupyterLite.