Inlined ipykernel.comm and IPython imports in comms.py
@@ -3,20 +3,12 @@ import uuid
import sys
import traceback
-from unittest import SkipTest
-
try:
from StringIO import StringIO
except:
from io import StringIO
-try:
- from ipykernel.comm import Comm as IPyComm
- from IPython import get_ipython
-except:
- raise SkipTest('ipykernel or IPython not available')
-
class StandardOutput(list):
"""
Context manager to capture standard output for any code it
@@ -157,6 +149,7 @@ class JupyterComm(Comm):
"""
def init(self):
+ from ipykernel.comm import Comm as IPyComm
if self._comm:
return
self._comm = IPyComm(target_name=self.id, data={})
@@ -212,6 +205,7 @@ class JupyterCommJS(JupyterComm):
"""
Initializes a Comms object
"""
+ from IPython import get_ipython
super(JupyterCommJS, self).__init__(plot, id, on_msg)
self.manager = get_ipython().kernel.comm_manager
self.manager.register_target(self.id, self._handle_open)
