diff --git a/IPython/frontend/qt/console/ipythonqt.py b/IPython/frontend/qt/console/ipythonqt.py index 2df4231..04d413c 100644 --- a/IPython/frontend/qt/console/ipythonqt.py +++ b/IPython/frontend/qt/console/ipythonqt.py @@ -30,6 +30,7 @@ from IPython.zmq.ipkernel import ( aliases as ipkernel_aliases, IPKernelApp ) +from IPython.zmq.session import Session from IPython.zmq.zmqshell import ZMQInteractiveShell @@ -214,7 +215,7 @@ aliases.update(dict( class IPythonQtConsoleApp(BaseIPythonApplication): name = 'ipython-qtconsole' default_config_file_name='ipython_config.py' - classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir] + classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir, Session] flags = Dict(flags) aliases = Dict(aliases) @@ -289,7 +290,8 @@ class IPythonQtConsoleApp(BaseIPythonApplication): shell_address=(self.ip, self.shell_port), sub_address=(self.ip, self.iopub_port), stdin_address=(self.ip, self.stdin_port), - hb_address=(self.ip, self.hb_port) + hb_address=(self.ip, self.hb_port), + config=self.config ) # start the kernel if not self.existing: diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 2d8a3e0..2db33fb 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -590,7 +590,7 @@ class IPKernelApp(KernelApp, InteractiveShellApp): aliases = Dict(aliases) flags = Dict(flags) - classes = [Kernel, ZMQInteractiveShell, ProfileDir] + classes = [Kernel, ZMQInteractiveShell, ProfileDir, Session] # configurables pylab = CaselessStrEnum(['tk', 'qt', 'wx', 'gtk', 'osx', 'inline', 'auto'], config=True, diff --git a/IPython/zmq/kernelapp.py b/IPython/zmq/kernelapp.py index fdb1b07..a732968 100644 --- a/IPython/zmq/kernelapp.py +++ b/IPython/zmq/kernelapp.py @@ -73,7 +73,7 @@ class KernelApp(BaseIPythonApplication): name='pykernel' aliases = Dict(kernel_aliases) flags = Dict(kernel_flags) - + classes = [Session] # the kernel class, as an importstring kernel_class = Unicode('IPython.zmq.pykernel.Kernel') kernel = Any() @@ -163,7 +163,7 @@ class KernelApp(BaseIPythonApplication): def init_session(self): """create our session object""" - self.session = Session(username=u'kernel') + self.session = Session(config=self.config, username=u'kernel') def init_io(self): """redirects stdout/stderr, and installs a display hook""" diff --git a/IPython/zmq/kernelmanager.py b/IPython/zmq/kernelmanager.py index 6a35efc..0101ee2 100644 --- a/IPython/zmq/kernelmanager.py +++ b/IPython/zmq/kernelmanager.py @@ -32,6 +32,7 @@ from zmq import POLLIN, POLLOUT, POLLERR from zmq.eventloop import ioloop # Local imports. +from IPython.config.loader import Config from IPython.utils import io from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS from IPython.utils.traitlets import HasTraits, Any, Instance, Type, TCPAddress @@ -676,11 +677,16 @@ class KernelManager(HasTraits): The REP channel is for the kernel to request stdin (raw_input) from the frontend. """ + # config object for passing to child configurables + config = Instance(Config) + # The PyZMQ Context to use for communication with the kernel. - context = Instance(zmq.Context,(),{}) + context = Instance(zmq.Context) + def _context_default(self): + return zmq.Context.instance() # The Session to use for communication with the kernel. - session = Instance(Session,(),{}) + session = Instance(Session) # The kernel process with which the KernelManager is communicating. kernel = Instance(Popen) @@ -706,8 +712,10 @@ class KernelManager(HasTraits): def __init__(self, **kwargs): super(KernelManager, self).__init__(**kwargs) + if self.session is None: + self.session = Session(config=self.config) # Uncomment this to try closing the context. - # atexit.register(self.context.close) + # atexit.register(self.context.term) #-------------------------------------------------------------------------- # Channel management methods: