Warning

This documentation is for an old version of IPython. You can find docs for newer versions here.

Module: kernel.kernelspec

3 Classes

class IPython.kernel.kernelspec.KernelSpec(*args, **kw)

Bases: IPython.utils.traitlets.HasTraits

classmethod from_resource_dir(resource_dir)

Create a KernelSpec object by reading kernel.json

Pass the path to the directory containing kernel.json.

class IPython.kernel.kernelspec.NoSuchKernel(name)

Bases: KeyError

__init__(name)
class IPython.kernel.kernelspec.KernelSpecManager(**kwargs)

Bases: IPython.config.configurable.Configurable

find_kernel_specs()

Returns a dict mapping kernel names to resource directories.

get_kernel_spec(kernel_name)

Returns a KernelSpec instance for the given kernel_name.

Raises NoSuchKernel if the given kernel name is not found.

install_kernel_spec(source_dir, kernel_name=None, user=False, replace=False)

Install a kernel spec by copying its directory.

If kernel_name is not given, the basename of source_dir will be used.

If user is False, it will attempt to install into the systemwide kernel registry. If the process does not have appropriate permissions, an OSError will be raised.

If replace is True, this will replace an existing kernel of the same name. Otherwise, if the destination already exists, an OSError will be raised.

install_native_kernel_spec(user=False)

Install the native kernel spec to the filesystem

This allows a Python 3 frontend to use a Python 2 kernel, or vice versa. The kernelspec will be written pointing to the Python executable on which this is run.

If user is False, it will attempt to install into the systemwide kernel registry. If the process does not have appropriate permissions, an OSError will be raised.

4 Functions

IPython.kernel.kernelspec.find_kernel_specs()

Returns a dict mapping kernel names to resource directories.

IPython.kernel.kernelspec.get_kernel_spec(kernel_name)

Returns a KernelSpec instance for the given kernel_name.

Raises KeyError if the given kernel name is not found.

IPython.kernel.kernelspec.install_kernel_spec(source_dir, kernel_name=None, user=False, replace=False)

Install a kernel spec by copying its directory.

If kernel_name is not given, the basename of source_dir will be used.

If user is False, it will attempt to install into the systemwide kernel registry. If the process does not have appropriate permissions, an OSError will be raised.

If replace is True, this will replace an existing kernel of the same name. Otherwise, if the destination already exists, an OSError will be raised.

IPython.kernel.kernelspec.install_native_kernel_spec(user=False)

Install the native kernel spec to the filesystem

This allows a Python 3 frontend to use a Python 2 kernel, or vice versa. The kernelspec will be written pointing to the Python executable on which this is run.

If user is False, it will attempt to install into the systemwide kernel registry. If the process does not have appropriate permissions, an OSError will be raised.