Skip to content

Commit decff87

Browse files
committed
Merge pull request #175 from SylvainCorlay/comm_info
Remove workaround for comm_info message
2 parents 483463f + b6440b4 commit decff87

File tree

3 files changed

+6
-44
lines changed

3 files changed

+6
-44
lines changed

ipywidgets/__init__.py

-21
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

+3-20
Original file line numberDiff line numberDiff line change
@@ -266,30 +266,13 @@ define([
266266

267267
WidgetManager.prototype._get_comm_info = function() {
268268
/**
269-
* Gets a promise for the open comms in the backend
269+
* Gets a promise for the valid widget models.
270270
*/
271-
272-
// Version using the comm_list_[request/reply] shell message.
273-
/*var that = this;
274-
return new Promise(function(resolve, reject) {
275-
kernel.comm_info(function(msg) {
276-
resolve(msg['content']['comms']);
277-
});
278-
});*/
279-
280-
// Workaround for absence of comm_list_[request/reply] shell message.
281-
// Create a new widget that gives the comm list and commits suicide.
282271
var that = this;
283272
return this._get_connected_kernel().then(function(kernel) {
284273
return new Promise(function(resolve, reject) {
285-
var comm = kernel.comm_manager.new_comm('ipython.widget',
286-
{'widget_class': 'ipywidgets.CommInfo'},
287-
'comm_info');
288-
comm.on_msg(function(msg) {
289-
var data = msg.content.data;
290-
if (data.content && data.method === 'custom') {
291-
resolve(data.content.comms);
292-
}
274+
kernel.comm_info('ipython.widget', function(msg) {
275+
resolve(msg['content']['comms']);
293276
});
294277
});
295278
});

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ def run(self):
279279

280280
setuptools_args = {}
281281
install_requires = setuptools_args['install_requires'] = [
282-
'ipython>=4.0.0dev0',
283-
'ipykernel',
282+
'ipython>=4.0.0',
283+
'ipykernel>=4.2.0',
284284
'traitlets',
285-
'notebook',
285+
'notebook>=4.1.0b1',
286286
]
287287

288288
extras_require = setuptools_args['extras_require'] = {

0 commit comments

Comments
 (0)