Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ipykernel/ipkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ def banner(self):

def start(self):
self.shell.exit_now = False
self.debugpy_stream.on_recv(self.dispatch_debugpy, copy=False)
if self.debugpy_stream is None:
self.log.warning("debugpy_stream undefined, debugging will not be enabled")
else:
self.debugpy_stream.on_recv(self.dispatch_debugpy, copy=False)
super(IPythonKernel, self).start()

def set_parent(self, ident, parent, channel='shell'):
Expand Down
47 changes: 40 additions & 7 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,41 @@ def _update_eventloop(self, change):
profile_dir = Instance('IPython.core.profiledir.ProfileDir', allow_none=True)
shell_stream = Instance(ZMQStream, allow_none=True)

@property
def shell_streams(self):
shell_streams = List(
help="""Deprecated shell_streams alias. Use shell_stream

.. versionchanged:: 6.0
shell_streams is deprecated. Use shell_stream.
"""
)

@default("shell_streams")
def _shell_streams_default(self):
warnings.warn(
'Property shell_streams is deprecated in favor of shell_stream',
DeprecationWarning
"Kernel.shell_streams is deprecated in ipykernel 6.0. Use Kernel.shell_stream",
DeprecationWarning,
stacklevel=2,
)
return [self.shell_stream]
if self.shell_stream is not None:
return [self.shell_stream]
else:
return []

@observe("shell_streams")
def _shell_streams_changed(self, change):
warnings.warn(
"Kernel.shell_streams is deprecated in ipykernel 6.0. Use Kernel.shell_stream",
DeprecationWarning,
stacklevel=2,
)
if len(change.new) > 1:
warnings.warn(
"Kernel only supports one shell stream. Additional streams will be ignored.",
RuntimeWarning,
stacklevel=2,
)
if change.new:
self.shell_stream = change.new[0]

control_stream = Instance(ZMQStream, allow_none=True)

Expand Down Expand Up @@ -177,8 +205,6 @@ def __init__(self, **kwargs):
self.control_handlers[msg_type] = getattr(self, msg_type)

self.control_queue = Queue()
if 'control_thread' in kwargs:
kwargs['control_thread'].io_loop.add_callback(self.poll_control_queue)

@gen.coroutine
def dispatch_control(self, msg):
Expand Down Expand Up @@ -424,6 +450,13 @@ def start(self):

self.control_stream.on_recv(self.dispatch_control, copy=False)

if self.control_thread:
control_loop = self.control_thread.io_loop
else:
control_loop = self.io_loop

control_loop.add_callback(self.poll_control_queue)

self.shell_stream.on_recv(
partial(
self.schedule_dispatch,
Expand Down