Handlers#

Module: jupyterlab_server.handlers#

JupyterLab Server handlers

class jupyterlab_server.handlers.LabHandler(application: Application, request: 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: Application, request: 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: Application, request: HTTPServerRequest, **kwargs: Any)#
get(schema_name='')#

Get setting(s)

initialize(name, app_settings_dir, schemas_dir, settings_dir, labextensions_path, **kwargs)#
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.

  • str (schema_name) – Schema name. Default is “”.

  • 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:

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.

Return type:

tuple

Module: jupyterlab_server.themes_handler#

Tornado handlers for dynamic theme loading.

class jupyterlab_server.themes_handler.ThemesHandler(application: Application, request: 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.

initialize(path, default_filename=None, no_cache_paths=None, themes_url=None, labextensions_path=None, **kwargs)#

Module: jupyterlab_server.translations_handler#

Translation handler.

class jupyterlab_server.translations_handler.TranslationsHandler(application: Application, request: 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: Application, request: HTTPServerRequest, **kwargs: Any)#
delete(space_name)#

Remove a workspace

get(space_name='')#

Get workspace(s) data

initialize(name, manager: WorkspacesManager, **kwargs)#
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: django/django