Process#

Module: jupyterlab_server.process#

JupyterLab Server process handler

class jupyterlab_server.process.Process(cmd: list[str], logger: Logger | None = None, cwd: str | None = None, kill_event: Event | None = None, env: dict[str, str] | None = None, quiet: bool = False)#

A wrapper for a child process.

get_log() Logger#

Get our logger.

terminate() int#

Terminate the process and return the exit code.

wait() int#

Wait for the process to finish.

Return type:

The process exit code.

wait_async() Any#

Asynchronously wait for the process to finish.

class jupyterlab_server.process.WatchHelper(cmd: list[str], startup_regex: str, logger: Logger | None = None, cwd: str | None = None, kill_event: Event | None = None, env: dict[str, str] | None = None)#

A process helper for a watch process.

terminate() int#

Terminate the process.

jupyterlab_server.process.which(command: str, env: dict[str, str] | None = None) str#

Get the full path to a command.

Parameters:
  • command (str) – The command name or path.

  • env (dict, optional) – The environment variables, defaults to os.environ.

Module: jupyterlab_server.process_app#

A lab app that runs a sub process for a demo or a test.

ProcessApp#

class jupyterlab_server.process_app.ProcessApp(**kwargs: Any)#

A jupyterlab app that runs a separate process and exits on completion.

answer_yes c.ProcessApp.answer_yes = Bool(False)#

Answer yes to any prompts.

app_name c.ProcessApp.app_name = Unicode('')#

The name of the application.

app_namespace c.ProcessApp.app_namespace = Unicode('')#

The namespace of the application.

app_settings_dir c.ProcessApp.app_settings_dir = Unicode('')#

The application settings directory.

app_url c.ProcessApp.app_url = Unicode('/lab')#

The url path for the application.

app_version c.ProcessApp.app_version = Unicode('')#

The version of the application.

cache_files c.ProcessApp.cache_files = Bool(True)#

Whether to cache files on the server. This should be True except in dev mode.

config_file c.ProcessApp.config_file = Unicode('')#

Full path of a config file.

config_file_name c.ProcessApp.config_file_name = Unicode('')#

Specify a config file to load.

copy_absolute_path c.ProcessApp.copy_absolute_path = Bool(False)#

Whether getting a relative (False) or absolute (True) path when copying a path.

default_url c.ProcessApp.default_url = Unicode('')#

No help string is provided.

extra_labextensions_path c.ProcessApp.extra_labextensions_path = List()#

Extra paths to look for federated JupyterLab extensions

generate_config c.ProcessApp.generate_config = Bool(False)#

Generate default config file.

handlers c.ProcessApp.handlers = List()#

Handlers appended to the server.

jinja2_options c.ProcessApp.jinja2_options = Dict()#

Options to pass to the jinja2 environment for this

labextensions_path c.ProcessApp.labextensions_path = List()#

The standard paths to look in for federated JupyterLab extensions

labextensions_url c.ProcessApp.labextensions_url = Unicode('')#

The url for federated JupyterLab extensions

listings_url c.ProcessApp.listings_url = Unicode('')#

The listings url.

log_datefmt c.ProcessApp.log_datefmt = Unicode('%Y-%m-%d %H:%M:%S')#

The date format used by logging formatters for %(asctime)s

log_format c.ProcessApp.log_format = Unicode('[%(name)s]%(highlevel)s %(message)s')#

The Logging format template

log_level c.ProcessApp.log_level = Enum(30)#

Set the log level by value or name.

logging_config c.ProcessApp.logging_config = Dict()#

Configure additional log handlers.

The default stderr logs handler is configured by the log_level, log_datefmt and log_format settings.

This configuration can be used to configure additional handlers (e.g. to output the log to a file) or for finer control over the default handlers.

If provided this should be a logging configuration dictionary, for more information see: https://docs.python.org/3/library/logging.config.html#logging-config-dictschema

This dictionary is merged with the base logging configuration which defines the following:

  • A logging formatter intended for interactive use called console.

  • A logging handler that writes to stderr called console which uses the formatter console.

  • A logger with the name of this application set to DEBUG level.

This example adds a new handler that writes to a file:

c.Application.logging_config = {
    "handlers": {
        "file": {
            "class": "logging.FileHandler",
            "level": "DEBUG",
            "filename": "<path/to/file>",
        }
    },
    "loggers": {
        "<application-name>": {
            "level": "DEBUG",
            # NOTE: if you don't list the default "console"
            # handler here then it will be disabled
            "handlers": ["console", "file"],
        },
    },
}
notebook_starts_kernel c.ProcessApp.notebook_starts_kernel = Bool(True)#

Whether a notebook should start a kernel automatically.

schemas_dir c.ProcessApp.schemas_dir = Unicode('')#

The optional location of the settings schemas directory. If given, a handler will be added for settings.

settings c.ProcessApp.settings = Dict()#

Settings that will passed to the server.

settings_url c.ProcessApp.settings_url = Unicode('')#

The url path of the settings handler.

show_config c.ProcessApp.show_config = Bool(False)#

Instead of starting the Application, dump configuration to stdout

show_config_json c.ProcessApp.show_config_json = Bool(False)#

Instead of starting the Application, dump configuration to stdout (as JSON)

static_dir c.ProcessApp.static_dir = Unicode('')#

The optional location of local static files. If given, a static file handler will be added.

static_paths c.ProcessApp.static_paths = List()#

paths to search for serving static files.

This allows adding javascript/css to be available from the notebook server machine, or overriding individual files in the IPython

static_url_prefix c.ProcessApp.static_url_prefix = Unicode('')#

Url where the static assets for the extension are served.

template_paths c.ProcessApp.template_paths = List()#

Paths to search for serving jinja templates.

Can be used to override templates from notebook.templates.

templates_dir c.ProcessApp.templates_dir = Unicode('')#

The application templates directory.

themes_dir c.ProcessApp.themes_dir = Unicode('')#

The optional location of the themes directory. If given, a handler will be added for themes.

themes_url c.ProcessApp.themes_url = Unicode('')#

The theme url.

translations_api_url c.ProcessApp.translations_api_url = Unicode('')#

The url path of the translations handler.

tree_url c.ProcessApp.tree_url = Unicode('')#

The url path of the tree handler.

user_settings_dir c.ProcessApp.user_settings_dir = Unicode('')#

The optional location of the user settings directory.

workspaces_api_url c.ProcessApp.workspaces_api_url = Unicode('')#

The url path of the workspaces API.

workspaces_dir c.ProcessApp.workspaces_dir = Unicode('')#

The optional location of the saved workspaces directory. If given, a handler will be added for workspaces.