Skip to content

Commit f78a957

Browse files
committed
Remove workaround for comm_info message
1 parent bb2a149 commit f78a957

File tree

3 files changed

+5
-43
lines changed

3 files changed

+5
-43
lines changed

ipywidgets/__init__.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,3 @@ def _handle_ipython():
3535
load_ipython_extension(ip)
3636

3737
_handle_ipython()
38-
39-
40-
# Workaround for the absence of a comm_info_[request/reply] shell message
41-
class CommInfo(Widget):
42-
"""CommInfo widgets are is typically instantiated by the front-end.
43-
44-
As soon as it is instantiated, it sends the collection of valid comms, and
45-
kills itself. It is a workaround to the absence of comm_info shell
46-
message.
47-
"""
48-
49-
def __init__(self, **kwargs):
50-
super(CommInfo, self).__init__(**kwargs)
51-
target_name = 'ipython.widget'
52-
comms = {
53-
k: dict(target_name=v.target_name)
54-
for (k, v) in self.comm.kernel.comm_manager.comms.items()
55-
if v is not self.comm and (v.target_name == target_name or target_name is None)
56-
}
57-
self.send(dict(comms=comms))
58-
self.close()

ipywidgets/static/widgets/js/manager.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -635,30 +635,13 @@ define([
635635

636636
WidgetManager.prototype._get_comm_info = function() {
637637
/**
638-
* Gets a promise for the open comms in the backend
638+
* Gets a promise for the valid widget models.
639639
*/
640-
641-
// Version using the comm_list_[request/reply] shell message.
642-
/*var that = this;
643-
return new Promise(function(resolve, reject) {
644-
kernel.comm_info(function(msg) {
645-
resolve(msg['content']['comms']);
646-
});
647-
});*/
648-
649-
// Workaround for absence of comm_list_[request/reply] shell message.
650-
// Create a new widget that gives the comm list and commits suicide.
651640
var that = this;
652641
return this._get_connected_kernel().then(function(kernel) {
653642
return new Promise(function(resolve, reject) {
654-
var comm = kernel.comm_manager.new_comm('ipython.widget',
655-
{'widget_class': 'ipywidgets.CommInfo'},
656-
'comm_info');
657-
comm.on_msg(function(msg) {
658-
var data = msg.content.data;
659-
if (data.content && data.method === 'custom') {
660-
resolve(data.content.comms);
661-
}
643+
kernel.comm_info('ipython.widget', function(msg) {
644+
resolve(msg['content']['comms']);
662645
});
663646
});
664647
});

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ def run(self):
276276

277277
setuptools_args = {}
278278
install_requires = setuptools_args['install_requires'] = [
279-
'ipython>=4.0.0dev0',
280-
'ipykernel',
279+
'ipython>=4.0.0',
280+
'ipykernel>=4.1.0',
281281
'traitlets',
282282
'notebook',
283283
]

0 commit comments

Comments
 (0)