diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 4a24fe3..d0d4796 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -270,6 +270,7 @@ class InteractiveShell(SingletonConfigurable): display_formatter = Instance(DisplayFormatter) displayhook_class = Type(DisplayHook) display_pub_class = Type(DisplayPublisher) + data_pub_class = None exit_now = CBool(False) exiter = Instance(ExitAutocall) @@ -483,6 +484,7 @@ class InteractiveShell(SingletonConfigurable): self.init_prompts() self.init_display_formatter() self.init_display_pub() + self.init_data_pub() self.init_displayhook() self.init_reload_doctest() self.init_latextool() @@ -659,6 +661,13 @@ class InteractiveShell(SingletonConfigurable): self.display_pub = self.display_pub_class(config=self.config) self.configurables.append(self.display_pub) + def init_data_pub(self): + if not self.data_pub_class: + self.data_pub = None + return + self.data_pub = self.data_pub_class(config=self.config) + self.configurables.append(self.data_pub) + def init_displayhook(self): # Initialize displayhook, set in/out prompts and printing system self.displayhook = self.displayhook_class( diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 2f756ff..9b7309e 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -147,6 +147,8 @@ class Kernel(Configurable): self.shell.displayhook.topic = self._topic('pyout') self.shell.display_pub.session = self.session self.shell.display_pub.pub_socket = self.iopub_socket + self.shell.data_pub.session = self.session + self.shell.data_pub.pub_socket = self.iopub_socket # TMP - hack while developing self.shell._reply_content = None @@ -353,6 +355,7 @@ class Kernel(Configurable): # Set the parent message of the display hook and out streams. shell.displayhook.set_parent(parent) shell.display_pub.set_parent(parent) + shell.data_pub.set_parent(parent) sys.stdout.set_parent(parent) sys.stderr.set_parent(parent) @@ -538,6 +541,7 @@ class Kernel(Configurable): shell = self.shell shell.displayhook.set_parent(parent) shell.display_pub.set_parent(parent) + shell.data_pub.set_parent(parent) sys.stdout.set_parent(parent) sys.stderr.set_parent(parent) diff --git a/IPython/zmq/zmqshell.py b/IPython/zmq/zmqshell.py index 0691ef6..48675b8 100644 --- a/IPython/zmq/zmqshell.py +++ b/IPython/zmq/zmqshell.py @@ -44,6 +44,7 @@ from IPython.utils import py3compat from IPython.utils.traitlets import Instance, Type, Dict, CBool, CBytes from IPython.utils.warn import warn, error from IPython.zmq.displayhook import ZMQShellDisplayHook +from IPython.zmq.datapub import ZMQDataPublisher from IPython.zmq.session import extract_header from session import Session @@ -464,6 +465,7 @@ class ZMQInteractiveShell(InteractiveShell): displayhook_class = Type(ZMQShellDisplayHook) display_pub_class = Type(ZMQDisplayPublisher) + data_pub_class = Type(ZMQDataPublisher) # Override the traitlet in the parent class, because there's no point using # readline for the kernel. Can be removed when the readline code is moved