Module: jupyterlab_server.handlers#

JupyterLab Server handlers

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

Render the JupyterLab View.

get(mode: str | None = None, workspace: str | None = None, tree: str | None = None) None#

Get the JupyterLab html page.

get_page_config() dict[str, Any]#

Construct the page config object

jupyterlab_server.handlers.add_handlers(handlers: list[Any], extension_app: LabServerApp) None#

Add the appropriate handlers to the web app.

jupyterlab_server.handlers.is_url(url: str) bool#

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


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: str) None#

Get the listings for the extension manager.

jupyterlab_server.listings_handler.fetch_listings(logger: Logger | None) None#

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)#

A settings API handler.

get(schema_name: str = '') Any#

Get setting(s)

  • schema_name (str) – The id of a unique schema to send, added to the URL

  • NOTES (##) – An optional argument ids_only=true can be provided in the URL to get only the ids of the schemas instead of the content.

initialize(name: str, app_settings_dir: str, schemas_dir: str, settings_dir: str, labextensions_path: list[str], **kwargs: Any) None#

Initialize the handler.

put(schema_name: str) None#

Update a setting

jupyterlab_server.settings_handler.get_settings(app_settings_dir: str, schemas_dir: str, settings_dir: str, schema_name: str = '', overrides: dict[str, Any] | None = None, labextensions_path: list[str] | None = None, translator: Any = None, ids_only: bool = False) tuple[dict[str, Any], list[Any]]#

Get settings.

  • 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


The first item is a dictionary with a list of setting if no schema_name was provided (only the ids if ids_only=True), 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:


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: str, start: int | None = None, end: int | None = None) bytes | Generator[bytes, None, 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() int#

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

initialize(path: str | list[str], default_filename: str | None = None, no_cache_paths: list[str] | None = None, themes_url: str | None = None, labextensions_path: list[str] | None = None, **kwargs: Any) None#

Initialize the handler.

Module: jupyterlab_server.translations_handler#

Translation handler.

class jupyterlab_server.translations_handler.TranslationsHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)#

An API handler for translations.

get(locale: str | None = None) None#

Get installed language packs.

If locale is equals to “default”, the default locale will be used.


locale (str, optional) – If no locale is provided, it will list all the installed language packs. Default is None.

Module: jupyterlab_server.workspaces_handler#

Tornado handlers for frontend config storage.

class jupyterlab_server.workspaces_handler.WorkspacesHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)#

A workspaces API handler.

delete(space_name: str) None#

Remove a workspace

get(space_name: str = '') Any#

Get workspace(s) data

initialize(name: str, manager: WorkspacesManager, **kwargs: Any) None#

Initialize the handler.

put(space_name: str = '') None#

Update workspace data

jupyterlab_server.workspaces_handler.slugify(raw: str, base: str = '', sign: bool = True, max_length: int = 107) str#

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