twshell

Module: twshell

Inheritance diagram for IPython.twshell:

Twisted shell support.

XXX - This module is missing proper docs.

Classes

IPShellTwisted

class IPython.twshell.IPShellTwisted(argv=None, user_ns=None, debug=1, shell_class=<class 'IPython.twshell.TwistedInteractiveShell'>)

Run a Twisted reactor while in an IPython session.

Python commands can be passed to the thread where they will be executed. This is implemented by periodically checking for passed code using a Twisted reactor callback.

__init__(argv=None, user_ns=None, debug=1, shell_class=<class 'IPython.twshell.TwistedInteractiveShell'>)
mainloop()
run()

TwistedInteractiveShell

class IPython.twshell.TwistedInteractiveShell(name, usage=None, rc=Struct({'__allownew': True, 'args': None, 'opts': None}), user_ns=None, user_global_ns=None, banner2='', **kw)

Bases: IPython.iplib.InteractiveShell

Simple multi-threaded shell.

__init__(name, usage=None, rc=Struct({'__allownew': True, 'args': None, 'opts': None}), user_ns=None, user_global_ns=None, banner2='', **kw)
Similar to the normal InteractiveShell, but with threading control
kill()
Kill the thread, returning when it has been shut down.
runcode()

Execute a code object.

Multithreaded wrapper around IPython’s runcode().

runsource(source, filename='<input>', symbol='single')

Compile and run some source in the interpreter.

Modified version of code.py’s runsource(), to handle threading issues. See the original for full docstring details.

Functions

IPython.twshell.hijack_reactor()

Modifies Twisted’s reactor with a dummy so user code does not block IPython. This function returns the original ‘twisted.internet.reactor’ that has been hijacked.

NOTE: Make sure you call this AFTER you’ve installed the reactor of your choice.

IPython.twshell.install_gtk2()
Install gtk2 reactor, needs to be called bef