Handlers

Module: jupyterlab_server.handlers

JupyterLab Server handlers

class jupyterlab_server.handlers.LabHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)

Render the JupyterLab View.

get(mode=None, workspace=None, tree=None)

Get the JupyterLab html page.

get_page_config()

Construct the page config object

jupyterlab_server.handlers.add_handlers(handlers, extension_app)

Add the appropriate handlers to the web app.

jupyterlab_server.handlers.is_url(url)

Test whether a string is a full url (e.g. https://nasa.gov)

https://stackoverflow.com/a/52455972

Module: jupyterlab_server.listings_handler

Tornado handlers for listing extensions.

class jupyterlab_server.listings_handler.ListingsHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)

An handler that returns the listings specs.

get(path)

Get the listings for the extension manager.

jupyterlab_server.listings_handler.fetch_listings(logger)

Fetch the listings for the extension manager.

Module: jupyterlab_server.settings_handler

Tornado handlers for frontend config storage.

class jupyterlab_server.settings_handler.SettingsHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)
get(schema_name='')

Get setting(s)

put(schema_name)

Update a setting

jupyterlab_server.settings_handler.get_settings(app_settings_dir, schemas_dir, settings_dir, schema_name='', overrides=None, labextensions_path=None, translator=None)

Get settings.

Parameters
app_settings_dir:

Path to applications settings.

schemas_dir: str

Path to schemas.

settings_dir:

Path to settings.

schema_name str, optional

Schema name. Default is “”.

overrides: dict, optional

Settings overrides. If not provided, the overrides will be loaded from the app_settings_dir. Default is None.

labextensions_path: list, optional

List of paths to federated labextensions containing their own schema files.

translator: Callable[[Dict], Dict] or None, optional

Translate a schema. It requires the schema dictionary and returns its translation

Returns
tuple

The first item is a dictionary with a list of setting if no schema_name was provided, otherwise it is a dictionary with id, raw, scheme, settings and version keys. The second item is a list of warnings. Warnings will either be a list of i) strings with the warning messages or ii) None.

Module: jupyterlab_server.themes_handler

Tornado handlers for dynamic theme loading.

class jupyterlab_server.themes_handler.ThemesHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)

A file handler that mangles local urls in CSS files.

get_content(abspath, start=None, end=None)

Retrieve the content of the requested resource which is located at the given absolute path.

This method should either return a byte string or an iterator of byte strings.

get_content_size()

Retrieve the total size of the resource at the given path.

Module: jupyterlab_server.translations_handler

Translation handler.

class jupyterlab_server.translations_handler.TranslationsHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)
get(locale='')

Get installed language packs.

Parameters
locale: str, optional

If no locale is provided, it will list all the installed language packs. Default is “”.

Module: jupyterlab_server.workspaces_handler

Tornado handlers for frontend config storage.

class jupyterlab_server.workspaces_handler.WorkspacesHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)
delete(space_name)

Remove a workspace

ensure_directory()

Return the workspaces directory if set or raise error if not set

get(space_name='')

Get workspace(s) data

put(space_name='')

Update workspace data

jupyterlab_server.workspaces_handler.slugify(raw, base='', sign=True, max_length=107)

Use the common superset of raw and base values to build a slug shorter than max_length. By default, base value is an empty string. Convert spaces to hyphens. Remove characters that aren’t alphanumerics underscores, or hyphens. Convert to lowercase. Strip leading and trailing whitespace. Add an optional short signature suffix to prevent collisions. Modified from Django utils: https://github.com/django/django/blob/master/django/utils/text.py