Skip to content

Jupyter server extensions as applications [experimental]

Notifications You must be signed in to change notification settings

Zsailer/jupyter_server_extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jupyter_server_extension

Launch Jupyter server extensions as Jupyter applications.

This is an experimental library for making applications out of Jupyter server extensions.

How to write an extension

The following describes the pattern for writing a jupyter server extension that also works as a standalone application.

  1. Subclass the ExtensionHandler to handler API requests. This handler points the static_url to namespaced endpoints under the static url pattern.
from jupyter_server_extension.handler import JupyterExtensionHandler

class MyExtensionHandler(ExtensionHandler):

    def get(self):
        self.render_template("index.html")
  1. Subclass the ExtensionApp and add handlers.
from traitlets import Unicode
from jupyter_server_extension.application import ExtensionApp

class MyExtensionApp(ExtensionApp):

    name = Unicode("my_extension")

    static_paths = List(
        Unicode("/path/to/static/dir/"),
        help="""List of places to file static served files."""
    )

        
    def initialize_handlers(self):
        self.handlers = []
        self.handlers.append(
            (r'/myextension', MyExtensionHandler)
        )

# `launch_instance` method offers an entry point to start the server and application. 
main = MyExtensionApp.launch_instance

# `load_jupyter_server_extension` method allows extension to be appended to already running server. 
load_jupyter_server_extension = MyExtensionApp.load_jupyter_server_extension

About

Jupyter server extensions as applications [experimental]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages