IPython Documentation

Table Of Contents

Previous topic

Module: kernel.ioloop.restarter

Next topic

Module: kernel.kernelspecapp

This Page

Note

This documentation is for a development version of IPython. There may be significant differences from the latest stable release.

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: exceptions.KeyError

__init__(name)
class IPython.kernel.kernelspec.KernelSpecManager(*args, **kw)

Bases: IPython.utils.traitlets.HasTraits

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, system=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 system is True, 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(system=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 system is True, 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, system=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 system is True, 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(self, system=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 system is True, it will attempt to install into the systemwide kernel registry. If the process does not have appropriate permissions, an OSError will be raised.