Skip to content

Commit da8bb0f

Browse files
committed
Require jupyter_client>=7.0.0
1 parent 5d42760 commit da8bb0f

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

jupyter_console/completer.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77
from traitlets.config import Configurable
88
from traitlets import Float
99

10-
import jupyter_client
11-
12-
13-
# jupyter_client 7.0+ has async channel methods that we expect to be sync here
14-
if jupyter_client.version_info >= (7,):
15-
from jupyter_client.utils import run_sync
16-
else:
17-
run_sync = lambda x: x
10+
from jupyter_client.utils import run_sync
1811

1912

2013
class ZMQCompleter(Configurable):

jupyter_console/ptshell.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,7 @@
7676
from pygments.util import ClassNotFound
7777
from pygments.token import Token
7878

79-
import jupyter_client
80-
81-
82-
# jupyter_client 7.0+ has async channel methods that we expect to be sync here
83-
# also, `block` was removed from `get_msg()`
84-
if jupyter_client._version.version_info[0] >= 7:
85-
from jupyter_client.utils import run_sync
86-
JUPYTER_CLIENT_7 = True
87-
else:
88-
run_sync = lambda x: x
89-
JUPYTER_CLIENT_7 = False
79+
from jupyter_client.utils import run_sync
9080

9181

9282
def ask_yes_no(prompt, default=None, interrupt=None):
@@ -752,8 +742,6 @@ def run_cell(self, cell, store_history=True):
752742

753743
def handle_execute_reply(self, msg_id, timeout=None):
754744
kwargs = {"timeout": timeout}
755-
if not JUPYTER_CLIENT_7:
756-
kwargs["block"] = False
757745
msg = run_sync(self.client.shell_channel.get_msg)(**kwargs)
758746
if msg["parent_header"].get("msg_id", None) == msg_id:
759747

@@ -794,8 +782,6 @@ def handle_is_complete_reply(self, msg_id, timeout=None):
794782
msg = None
795783
try:
796784
kwargs = {"timeout": timeout}
797-
if not JUPYTER_CLIENT_7:
798-
kwargs["block"] = True
799785
msg = run_sync(self.client.shell_channel.get_msg)(**kwargs)
800786
except Empty:
801787
warn('The kernel did not respond to an is_complete_request. '
@@ -852,11 +838,9 @@ def include_output(self, msg):
852838

853839
async def handle_external_iopub(self, loop=None):
854840
while self.keep_running:
855-
# we need to check for keep_running from time to time as
856-
# we are blocking in an executor block which cannot be cancelled.
857-
poll_result = await loop.run_in_executor(
858-
None, self.client.iopub_channel.socket.poll, 500)
859-
if(poll_result):
841+
# we need to check for keep_running from time to time
842+
poll_result = await self.client.iopub_channel.socket.poll(500)
843+
if poll_result:
860844
self.handle_iopub()
861845

862846
def handle_iopub(self, msg_id=''):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
'Programming Language :: Python :: 3.9',
8989
],
9090
install_requires=[
91-
'jupyter_client',
91+
'jupyter_client>=7.0.0',
9292
'ipython',
9393
'ipykernel', # bless IPython kernel for now
9494
'prompt_toolkit>=2.0.0,<3.1.0,!=3.0.0,!=3.0.1',

0 commit comments

Comments
 (0)