Warning

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

Module: kernel.launcher

Utilities for launching kernels

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.

Parameters:

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

Returns:

argv : list(str)

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

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

Build Popen command list for launching an IPython kernel.

Parameters:

mod : str, optional (default ‘IPython.kernel’)

A string of an IPython module whose __main__ starts an IPython kernel

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.

Returns:

A Popen command list

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

Launches a localhost kernel, binding to the specified ports.

Parameters:

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).

Returns:

Popen instance for the kernel subprocess