diff --git a/IPython/html/tests/widgets/widget_button.js b/IPython/html/tests/widgets/widget_button.js
index 80f8673..673ad3b 100644
--- a/IPython/html/tests/widgets/widget_button.js
+++ b/IPython/html/tests/widgets/widget_button.js
@@ -39,7 +39,9 @@ casper.notebook_test(function () {
this.wait_for_output(button_index, 1);
this.then(function () {
- this.test.assertEquals(this.get_output_cell(button_index, 1).data['text/plain'], "'Clicked'",
+ this.test.assertEquals(this.get_output_cell(button_index, 1).text, "WARNING: The widget API is still considered experimental and \n may change by the next major release of IPython.\n",
+ 'Importing widgets show a warning');
+ this.test.assertEquals(this.get_output_cell(button_index, 2).data['text/plain'], "'Clicked'",
'Button click event fires.');
});
-});
\ No newline at end of file
+});
diff --git a/IPython/kernel/zmq/ipkernel.py b/IPython/kernel/zmq/ipkernel.py
index 89d9677..0143d12 100644
--- a/IPython/kernel/zmq/ipkernel.py
+++ b/IPython/kernel/zmq/ipkernel.py
@@ -5,7 +5,6 @@ import sys
import traceback
from IPython.core import release
-from IPython.html.widgets import Widget
from IPython.utils.py3compat import builtin_mod, PY3
from IPython.utils.tokenutil import token_at_cursor, line_at_cursor
from IPython.utils.traitlets import Instance, Type, Any
@@ -16,6 +15,12 @@ from .kernelbase import Kernel as KernelBase
from .serialize import serialize_object, unpack_apply_message
from .zmqshell import ZMQInteractiveShell
+
+def lazy_import_handle_comm_opened(*args, **kwargs):
+ from IPython.html.widgets import Widget
+ Widget.handle_comm_opened(*args, **kwargs)
+
+
class IPythonKernel(KernelBase):
shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
shell_class = Type(ZMQInteractiveShell)
@@ -59,7 +64,7 @@ class IPythonKernel(KernelBase):
self.comm_manager = CommManager(shell=self.shell, parent=self,
kernel=self)
- self.comm_manager.register_target('ipython.widget', Widget.handle_comm_opened)
+ self.comm_manager.register_target('ipython.widget', lazy_import_handle_comm_opened)
self.shell.configurables.append(self.comm_manager)
comm_msg_types = [ 'comm_open', 'comm_msg', 'comm_close' ]