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

Module: kernel.zmq.kernelbase

Base class for a kernel that talks to frontends over 0MQ.

1 Class

class IPython.kernel.zmq.kernelbase.Kernel(**kwargs)

Bases: IPython.config.configurable.SingletonConfigurable

abort_request(stream, ident, parent)

abort a specific msg by id

clear_request(stream, idents, parent)

Clear our namespace.


dispatch control requests

dispatch_shell(stream, msg)

dispatch shell requests

do_apply(content, bufs, msg_id, reply_metadata)

Override in subclasses to support the IPython parallel framework.


Override in subclasses to clear the namespace

This is only required for IPython.parallel.

do_complete(code, cursor_pos)

Override in subclasses to find completions.

do_execute(code, silent, store_history=True, user_expressions=None, allow_stdin=False)

Execute user code. Must be overridden by subclasses.

do_history(hist_access_type, output, raw, session=None, start=None, stop=None, n=None, pattern=None, unique=False)

Override in subclasses to access history.

do_inspect(code, cursor_pos, detail_level=0)

Override in subclasses to allow introspection.


Override in subclasses to find completions.


step eventloop just once


Override in subclasses to do things when the frontend shuts down the kernel.


enter eventloop

execute_request(stream, ident, parent)

handle an execute_request


Forward getpass to frontends

Raises:StdinNotImplentedError if active frontend doesn’t support stdin.

Forward raw_input to frontends

Raises:StdinNotImplentedError if active frontend doesn’t support stdin.

Record the ports that this kernel is using.

The creator of the Kernel instance must call this methods if they want the connect_request() method to return the port numbers.

send_response(stream, msg_or_type, content=None, ident=None, buffers=None, track=False, header=None, metadata=None)

Send a response to the message we’re currently processing.

This accepts all the parameters of IPython.kernel.zmq.session.Session.send() except parent.

This relies on set_parent() having been called for the current message.

set_parent(ident, parent)

Set the current parent_header

Side effects (IOPub messages) and replies are associated with the request that caused them via the parent_header.

The parent identity is used to route input_request messages on the stdin channel.


register dispatchers for streams