enhancement-proposals
enhancement-proposals copied to clipboard
[JEP 0028] Server extensions as Applications
From JEP 0028 (Jupyter Server):
Extensions as Applications
A new
ExtensionApp
class will be available injupyter_server.extensions.extensionapp
. It enables developers to make server extensions behave like standalone Jupyter applications. Jupyterlab is an example of this kind of server extension. It can be configured, initialized, and launched from the command line. When Lab is launched, it first initializes and configures a jupyter (notebook) server, then loads the configured jupyterlab extension and redirects the use to the Lab landing page.
ExtensionApp
handles the boilerplate code to make Jupyter applications that configure and launch server extensions directly. It inheritsjupyter_core.JupyterApp
and exposes a command line entry point:jupyter <extension-name>
. When an extension is launched, it first configures and starts a jupyter_server (ServerApp
); then, it loads the configured extension and redirects users to the extension's landing page. Extension developers simply inherit theExtensionApp
and add the extension'sload_jupyter_server_extension
as astaticmethod
.from jupyter_server.extensionapp import ExtensionApp from .extension import load_jupyter_server_extension class MyExtension(ExtensionApp): name = 'myextension' description = 'My server extension as a Jupyter app.' load_jupyter_server_extension = staticmethod(load_jupyter_server_extension)
ExtensionApp
s can be configured byjupyter_<extension-name>_config.py|json
as well. When the server extension is loaded by a server or launched from the command line, it searches the list ofjupyter --paths
for configured traits in these files.Initial experimental work resides in
jupyter_server_extension
.
Opening for further discussion here.