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

Module: kernel.launcher

Utilities for launching kernels


  • Min Ragan-Kelley

3 Functions

IPython.kernel.launcher.swallow_argv(argv, aliases=None, flags=None)

strip frontend-specific aliases and flags from an argument list

For use primarily in frontend apps that want to pass a subset of command-line arguments through to a subprocess, where frontend-specific flags and aliases should be removed from the list.


argv : list(str)

The starting argv, to be filtered

aliases : container of aliases (dict, list, set, etc.)

The frontend-specific aliases to be removed

flags : container of flags (dict, list, set, etc.)

The frontend-specific flags to be removed


argv : list(str)

The argv list, excluding flags and aliases that have been stripped

IPython.kernel.launcher.make_ipkernel_cmd(code, executable=None, extra_arguments=[], **kw)

Build Popen command list for launching an IPython kernel.


code : str,

A string of Python code that imports and executes a kernel entry point.

executable : str, optional (default sys.executable)

The Python executable to use for the kernel process.

extra_arguments : list, optional

A list of extra arguments to pass when executing the launch code.


A Popen command list

IPython.kernel.launcher.launch_kernel(cmd, stdin=None, stdout=None, stderr=None, independent=False, cwd=None, ipython_kernel=True, env=None, **kw)

Launches a localhost kernel, binding to the specified ports.


cmd : Popen list,

A string of Python code that imports and executes a kernel entry point.

stdin, stdout, stderr : optional (default None)

Standards streams, as defined in subprocess.Popen.

independent : bool, optional (default False)

If set, the kernel process is guaranteed to survive if this process dies. If not set, an effort is made to ensure that the kernel is killed when this process dies. Note that in this case it is still good practice to kill kernels manually before exiting.

cwd : path, optional

The working dir of the kernel process (default: cwd of this process).

ipython_kernel : bool, optional

Whether the kernel is an official IPython one, and should get a bit of special treatment.


Popen instance for the kernel subprocess