Jupyterlite server extension development

Hello again Jupyter community,

I am developing an extension that I intend to use with Jupyterlite. Now comes the time for me to build the “server” extension piece. Of course I read the documentation about developing server extensions for Jupyterlite.

The documentation states that Jupyterlite uses the same plugin architecture. What I would like to know are the differences. What is possible and not possible? I know some extensions are not compatible with Jupyterlite. Is it mostly due to the Python packages available for Pyodide or because of the architecture of the extension itself? What should we keep in mind when developing server extensions compatible with Jupyterlite?

As a subsidiary question, are there any basic server extension example for Jupyterlite that I could start from? I tried the cookiecutter template, but I found it very limited.

Thank you in advance, any insights would be appreciated :slight_smile:

Thibaut

Jupyterlite uses the same plugin architecture

… as the JupyterLab client application, not jupyter_server, jupyverse, or any other CPython-based HTTP server implementation. The “server” is a @lumino/application:Application, which supports dependency injection via Token injection with provides, requires and optional.

It answers the subset of the Jupyter Server REST API + WebSockets and is probably under 100kb on the wire (a bit hard to tell, due to the way the WebPack bundling works).

At present, blocking to wait for a emscripten machine (or other WASM approach) to start up, then fill in with ~Xmb of a WASM-compiled runtime (like python), then ~XXmb of web server dependencies (many of which wouldn’t work in the browser, if they were re-compiled) before the first request for e.g. contents, settings, etc. can be drawn has been discussed, but would likely not land in jupyterlite-core any time soon.

A lite server extension, as implemented in the cookiecutter, could choose to lazily create an emscripten machine (or a remote machine, presumably), without destroying the first-load experience, and even provide that underlying machine it to other lite server extensions to require.

1 Like

@bollwyvl Thank you for the explanation and documented reply.

I wrongly thought some pieces of jupyter_server were running in the browser but now I understand why it’s not possible and even wouldn’t work.

1 Like