Merge pull request #864 from ipython/termzmq

Two-process terminal frontend: this branch adds a new IPython frontend, invoked via

ipython console

that behaves much like the regular, old ipython, but runs over zeromq in two processes.  This means that such a client can connect to existing kernels initiated by the Qt console, the notebook or standalone (i.e. via `ipython kernel`).

We still have some internal architectural cleanups to perform to simplify how the various frontends talk to the kernels, but by having this main piece in, the complete picture is clearer, and that refactoring work can be carried post-0.12.

This frontend should still be considered experimental.
This commit is contained in:
Fernando Perez 2011-12-06 12:10:58 -08:00
commit 5876485b5f

View File

@ -55,6 +55,7 @@ from .notebookmanager import NotebookManager
from IPython.config.application import catch_config_error
from IPython.core.application import BaseIPythonApplication
from IPython.core.profiledir import ProfileDir
from IPython.lib.kernel import swallow_argv
from IPython.zmq.session import Session, default_secure
from IPython.zmq.zmqshell import ZMQInteractiveShell
from IPython.zmq.ipkernel import (
@ -283,27 +284,10 @@ class NotebookApp(BaseIPythonApplication):
if argv is None:
argv = sys.argv[1:]
self.kernel_argv = list(argv) # copy
# Scrub frontend-specific flags
self.kernel_argv = swallow_argv(argv, notebook_aliases, notebook_flags)
# Kernel should inherit default config file from frontend
self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
# Scrub frontend-specific flags
for a in argv:
if a.startswith('-') and a.lstrip('-') in notebook_flags:
self.kernel_argv.remove(a)
swallow_next = False
for a in argv:
if swallow_next:
self.kernel_argv.remove(a)
swallow_next = False
continue
if a.startswith('-'):
split = a.lstrip('-').split('=')
alias = split[0]
if alias in notebook_aliases:
self.kernel_argv.remove(a)
if len(split) == 1:
# alias passed with arg via space
swallow_next = True
def init_configurables(self):
# Don't let Qt or ZMQ swallow KeyboardInterupts.