Kernel Provider

The Kernel Provider API is what a third-party would implement to introduce a form of kernel management that might differ from the more common KernelSpecProvider kernel. For example, a kernel provider might want to launch (and manage) kernels across a Kubernetes cluster. They would then implement a provider that performs the necessary action for launch and provide a KernelManager instance that can perform the appropriate actions to control the kernel’s lifecycle.

See also

Kernel Providers

class jupyter_kernel_mgmt.discovery.KernelProviderBase
abstract find_kernels()

Return an iterator of (kernel_name, kernel_info_dict) tuples.

abstract async launch(name, cwd=None, launch_params=None)

Launch a kernel, returns a 2-tuple of (connection_info, kernel_manager).

name will be one of the kernel names produced by find_kernels() and known to this provider.

cwd (optional) a string that specifies the path to the current directory of the notebook as conveyed by the client. Its interpretation is provider-specific.

launch_params (optional) a dictionary consisting of the launch parameters used to launch the kernel. Its interpretation is provider-specific.

This method launches and manages the kernel in an asynchronous (non-blocking) manner.

load_config(config=None)

Loads the configuration corresponding to the hosting application. This method is called during KernelFinder initialization prior to any other methods. The Kernel provider is responsible for interpreting the config parameter (when present).

config (optional) an instance of Config consisting of the hosting application’s configurable traitlets.

class jupyter_kernel_mgmt.discovery.KernelSpecProvider(search_path=None)

Offers kernel types from installed kernelspec directories.

find_kernels()

Return an iterator of (kernel_name, kernel_info_dict) tuples.

async launch(name, cwd=None, launch_params=None)

Launch a kernel, returns a 2-tuple of (connection_info, kernel_manager).

name will be one of the kernel names produced by find_kernels() and known to this provider.

cwd (optional) a string that specifies the path to the current directory of the notebook as conveyed by the client. Its interpretation is provider-specific.

launch_params (optional) a dictionary consisting of the launch parameters used to launch the kernel. Its interpretation is provider-specific.

This method launches and manages the kernel in an asynchronous (non-blocking) manner.

class jupyter_kernel_mgmt.discovery.IPykernelProvider

Offers a kernel type using the Python interpreter it’s running in. This checks if ipykernel is importable first. If import fails, it doesn’t offer a kernel type.

find_kernels()

Return an iterator of (kernel_name, kernel_info_dict) tuples.

async launch(name, cwd=None, launch_params=None)

Launch a kernel, returns a 2-tuple of (connection_info, kernel_manager).

name will be one of the kernel names produced by find_kernels() and known to this provider.

cwd (optional) a string that specifies the path to the current directory of the notebook as conveyed by the client. Its interpretation is provider-specific.

launch_params (optional) a dictionary consisting of the launch parameters used to launch the kernel. Its interpretation is provider-specific.

This method launches and manages the kernel in an asynchronous (non-blocking) manner.