IPython Documentation

Table Of Contents

Previous topic

Module: kernel.ioloop.restarter

Next topic

Module: kernel.manager

This Page

Module: kernel.launcher

Utilities for launching kernels

Authors:

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

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(code, executable=None, extra_arguments=, []**kw)

Build Popen command list for launching an IPython kernel.

Parameters:

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.

Returns:

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.

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

ipython_kernel : bool, optional

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

Returns:

Popen instance for the kernel subprocess :