enhancement-proposals icon indicating copy to clipboard operation
enhancement-proposals copied to clipboard

[JEP 0028] Server extensions as Applications

Open Zsailer opened this issue 5 years ago • 0 comments

From JEP 0028 (Jupyter Server):

Extensions as Applications

A new ExtensionApp class will be available in jupyter_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 inherits jupyter_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 the ExtensionApp and add the extension's load_jupyter_server_extension as a staticmethod.

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)

ExtensionApps can be configured by jupyter_<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 of jupyter --paths for configured traits in these files.

Initial experimental work resides in jupyter_server_extension.

Opening for further discussion here.

Zsailer avatar Feb 28 '19 22:02 Zsailer