ipykernel.inprocess package#

Submodules#

Implements a fully blocking kernel client.

Useful for test suites and blocking terminal interfaces.

class ipykernel.inprocess.blocking.BlockingInProcessChannel(*args, **kwds)#

Bases: InProcessChannel

A blocking in-process channel.

call_handlers(msg)#

Call the handlers for a message.

get_msg(block=True, timeout=None)#

Gets a message if there is one that is ready.

get_msgs()#

Get all messages that are currently ready.

msg_ready()#

Is there a message that has been received?

class ipykernel.inprocess.blocking.BlockingInProcessKernelClient(**kwargs)#

Bases: InProcessKernelClient

A blocking in-process kernel client.

iopub_channel_class#

A trait whose value must be a subclass of a specified class.

shell_channel_class#

A trait whose value must be a subclass of a specified class.

stdin_channel_class#

A trait whose value must be a subclass of a specified class.

wait_for_ready()#

Wait for kernel info reply on shell channel.

class ipykernel.inprocess.blocking.BlockingInProcessStdInChannel(*args, **kwds)#

Bases: BlockingInProcessChannel

A blocking in-process stdin channel.

call_handlers(msg)#

Overridden for the in-process channel.

This methods simply calls raw_input directly.

A kernel client for in-process kernels.

class ipykernel.inprocess.channels.InProcessChannel(client=None)#

Bases: object

Base class for in-process channels.

call_handlers(msg)#

This method is called in the main thread when a message arrives.

Subclasses should override this method to handle incoming messages.

call_handlers_later(*args, **kwds)#

Call the message handlers later.

The default implementation just calls the handlers immediately, but this method exists so that GUI toolkits can defer calling the handlers until after the event loop has run, as expected by GUI frontends.

flush(timeout=1.0)#

Flush the channel.

is_alive()#

Test if the channel is alive.

process_events()#

Process any pending GUI events.

This method will be never be called from a frontend without an event loop (e.g., a terminal frontend).

proxy_methods: List[object] = []#
start()#

Start the channel.

stop()#

Stop the channel.

class ipykernel.inprocess.channels.InProcessHBChannel(client=None)#

Bases: object

A dummy heartbeat channel interface for in-process kernels.

Normally we use the heartbeat to check that the kernel process is alive. When the kernel is in-process, that doesn’t make sense, but clients still expect this interface.

is_alive()#

Test if the channel is alive.

is_beating()#

Test if the channel is beating.

pause()#

Pause the channel.

start()#

Start the channel.

stop()#

Stop the channel.

time_to_dead = 3.0#
unpause()#

Unpause the channel.

A client for in-process kernels.

class ipykernel.inprocess.client.InProcessKernelClient(**kwargs)#

Bases: KernelClient

A client for an in-process kernel.

This class implements the interface of jupyter_client.clientabc.KernelClientABC and allows (asynchronous) frontends to be used seamlessly with an in-process kernel.

See jupyter_client.client.KernelClient for docstrings.

comm_info(target_name=None)#

Request a dictionary of valid comms and their targets.

complete(code, cursor_pos=None)#

Get code completion.

property control_channel#

Get the control channel object for this kernel.

control_channel_class#

A trait whose value must be a subclass of a specified class.

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

Execute code on the client.

get_connection_info()#

Get the connection info for the client.

get_control_msg(block=True, timeout=None)#

Get a control message.

get_iopub_msg(block=True, timeout=None)#

Get an iopub message.

get_shell_msg(block=True, timeout=None)#

Get a shell message.

get_stdin_msg(block=True, timeout=None)#

Get a stdin message.

property hb_channel#

Get the hb channel object for this kernel.

hb_channel_class#

A trait whose value must be a subclass of a specified class.

history(raw=True, output=False, hist_access_type='range', **kwds)#

Get code history.

input(string)#

Handle kernel input.

inspect(code, cursor_pos=None, detail_level=0)#

Get code inspection.

property iopub_channel#

Get the iopub channel object for this kernel.

iopub_channel_class#

A trait whose value must be a subclass of a specified class.

is_complete(code)#

Handle an is_complete request.

kernel#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

kernel_info()#

Request kernel info.

property shell_channel#

Get the shell channel object for this kernel.

shell_channel_class#

A trait whose value must be a subclass of a specified class.

shutdown(restart=False)#

Handle shutdown.

start_channels(*args, **kwargs)#

Start the channels on the client.

property stdin_channel#

Get the stdin channel object for this kernel.

stdin_channel_class#

A trait whose value must be a subclass of a specified class.

Shared constants.

An in-process kernel

class ipykernel.inprocess.ipkernel.InProcessInteractiveShell(**kwargs: Any)#

Bases: ZMQInteractiveShell

An in-process interactive shell.

enable_gui(gui=None)#

Enable GUI integration for the kernel.

enable_matplotlib(gui=None)#

Enable matplotlib integration for the kernel.

enable_pylab(gui=None, import_all=True, welcome_message=False)#

Activate pylab support at runtime.

kernel: InProcessKernel#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class ipykernel.inprocess.ipkernel.InProcessKernel(**kwargs: Any)#

Bases: IPythonKernel

An in-process kernel.

async execute_request(stream, ident, parent)#

Override for temporary IO redirection.

frontends#

An instance of a Python list.

gui#

An enum whose value must be in a given sequence.

iopub_socket: BackgroundSocket#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

iopub_thread: IOPubThread#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

raw_input_str#

A trait which allows any value.

shell_class#

A trait whose value must be a subclass of a specified class.

shell_stream#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

start()#

Override registration of dispatchers for streams.

stderr#

A trait which allows any value.

stdin_socket#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

stdout#

A trait which allows any value.

A kernel manager for in-process kernels.

class ipykernel.inprocess.manager.InProcessKernelManager(*args, **kwargs)#

Bases: KernelManager

A manager for an in-process kernel.

This class implements the interface of jupyter_client.kernelmanagerabc.KernelManagerABC and allows (asynchronous) frontends to be used seamlessly with an in-process kernel.

See jupyter_client.kernelmanager.KernelManager for docstrings.

client(**kwargs)#

Get a client for the kernel.

client_class: DottedObjectName#

A string holding a valid dotted object name in Python, such as A.b3._c

property has_kernel#

Has a kernel process been started that we are actively managing.

interrupt_kernel()#

Interrupt the kernel.

is_alive()#

Test if the kernel is alive.

kernel#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

restart_kernel(now=False, **kwds)#

Restart the kernel.

shutdown_kernel()#

Shutdown the kernel.

signal_kernel(signum)#

Send a signal to the kernel.

start_kernel(**kwds)#

Start the kernel.

Defines a dummy socket implementing (part of) the zmq.Socket interface.

class ipykernel.inprocess.socket.DummySocket(*args, **kwargs)#

Bases: HasTraits

A dummy socket implementing (part of) the zmq.Socket interface.

context#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

flush(timeout=1.0)#

no-op to comply with stream API

message_sent#

An int trait.

queue#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

recv_multipart(flags=0, copy=True, track=False)#

Recv a multipart message.

send_multipart(msg_parts, flags=0, copy=True, track=False)#

Send a multipart message.

Module contents#