diff --git a/.gitignore b/.gitignore index 5704712..896fe85 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /jupyter_console-6.2.0.tar.gz /jupyter_console-6.3.0.tar.gz /jupyter_console-6.4.0.tar.gz +/jupyter_console-6.4.2.tar.gz diff --git a/0c7aca07d45ff009327599f6985c6a8ebbd98987.patch b/0c7aca07d45ff009327599f6985c6a8ebbd98987.patch deleted file mode 100644 index ee958ed..0000000 --- a/0c7aca07d45ff009327599f6985c6a8ebbd98987.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 0c7aca07d45ff009327599f6985c6a8ebbd98987 Mon Sep 17 00:00:00 2001 -From: David Brochart -Date: Tue, 1 Jun 2021 09:41:11 +0200 -Subject: [PATCH] Wrap jupyter_client's async functions with run_sync - ---- - .github/workflows/python-package.yml | 1 + - jupyter_console/ptshell.py | 16 +++++++++------- - 2 files changed, 10 insertions(+), 7 deletions(-) - -diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml -index eb8048e..fd5fcd0 100644 ---- a/.github/workflows/python-package.yml -+++ b/.github/workflows/python-package.yml -@@ -29,6 +29,7 @@ jobs: - pip install pytest pytest-cov - pip install . - python -m ipykernel.kernelspec --user -+ pip install https://github.com/jupyter/jupyter_client/archive/master.zip - - name: Test with pytest - run: | - pytest --cov jupyter_console -diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py -index a9daeed..d6dc1e7 100644 ---- a/jupyter_console/ptshell.py -+++ b/jupyter_console/ptshell.py -@@ -76,6 +76,8 @@ - from pygments.util import ClassNotFound - from pygments.token import Token - -+from jupyter_client.utils import run_sync -+ - - def ask_yes_no(prompt, default=None, interrupt=None): - """Asks a question and returns a boolean (y/n) answer. -@@ -705,8 +707,8 @@ def run_cell(self, cell, store_history=True): - return - - # flush stale replies, which could have been ignored, due to missed heartbeats -- while self.client.shell_channel.msg_ready(): -- self.client.shell_channel.get_msg() -+ while run_sync(self.client.shell_channel.msg_ready)(): -+ run_sync(self.client.shell_channel.get_msg)() - # execute takes 'hidden', which is the inverse of store_hist - msg_id = self.client.execute(cell, not store_history) - -@@ -739,7 +741,7 @@ def run_cell(self, cell, store_history=True): - #----------------- - - def handle_execute_reply(self, msg_id, timeout=None): -- msg = self.client.shell_channel.get_msg(block=False, timeout=timeout) -+ msg = run_sync(self.client.shell_channel.get_msg)(block=False, timeout=timeout) - if msg["parent_header"].get("msg_id", None) == msg_id: - - self.handle_iopub(msg_id) -@@ -778,7 +780,7 @@ def handle_is_complete_reply(self, msg_id, timeout=None): - ## Get the is_complete response: - msg = None - try: -- msg = self.client.shell_channel.get_msg(block=True, timeout=timeout) -+ msg = run_sync(self.client.shell_channel.get_msg)(block=True, timeout=timeout) - except Empty: - warn('The kernel did not respond to an is_complete_request. ' - 'Setting `use_kernel_is_complete` to False.') -@@ -849,8 +851,8 @@ def handle_iopub(self, msg_id=''): - - It only displays output that is caused by this session. - """ -- while self.client.iopub_channel.msg_ready(): -- sub_msg = self.client.iopub_channel.get_msg() -+ while run_sync(self.client.iopub_channel.msg_ready)(): -+ sub_msg = run_sync(self.client.iopub_channel.get_msg)() - msg_type = sub_msg['header']['msg_type'] - - # Update execution_count in case it changed in another session -@@ -1003,7 +1005,7 @@ def handle_image_callable(self, data, mime): - def handle_input_request(self, msg_id, timeout=0.1): - """ Method to capture raw_input - """ -- req = self.client.stdin_channel.get_msg(timeout=timeout) -+ req = run_sync(self.client.stdin_channel.get_msg)(timeout=timeout) - # in case any iopub came while we were waiting: - self.handle_iopub(msg_id) - if msg_id == req["parent_header"].get("msg_id"): diff --git a/7f2dc911b41df9ed7f3cdc09a6832451cbe69d15.patch b/7f2dc911b41df9ed7f3cdc09a6832451cbe69d15.patch deleted file mode 100644 index 0c6dff2..0000000 --- a/7f2dc911b41df9ed7f3cdc09a6832451cbe69d15.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 7f2dc911b41df9ed7f3cdc09a6832451cbe69d15 Mon Sep 17 00:00:00 2001 -From: David Brochart -Date: Tue, 9 Nov 2021 14:27:16 +0100 -Subject: [PATCH] Drop block kwarg from get_msg() for jupyter_client>=7.0 - ---- - jupyter_console/ptshell.py | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py -index 4608992..31f424d 100644 ---- a/jupyter_console/ptshell.py -+++ b/jupyter_console/ptshell.py -@@ -80,10 +80,13 @@ - - - # jupyter_client 7.0+ has async channel methods that we expect to be sync here -+# also, `block` was removed from `get_msg()` - if jupyter_client._version.version_info[0] >= 7: - from jupyter_client.utils import run_sync -+ JUPYTER_CLIENT_7 = True - else: - run_sync = lambda x: x -+ JUPYTER_CLIENT_7 = False - - - def ask_yes_no(prompt, default=None, interrupt=None): -@@ -748,7 +751,10 @@ def run_cell(self, cell, store_history=True): - #----------------- - - def handle_execute_reply(self, msg_id, timeout=None): -- msg = run_sync(self.client.shell_channel.get_msg)(block=False, timeout=timeout) -+ kwargs = {"timeout": timeout} -+ if not JUPYTER_CLIENT_7: -+ kwargs["block"] = False -+ msg = run_sync(self.client.shell_channel.get_msg)(**kwargs) - if msg["parent_header"].get("msg_id", None) == msg_id: - - self.handle_iopub(msg_id) -@@ -787,7 +793,10 @@ def handle_is_complete_reply(self, msg_id, timeout=None): - ## Get the is_complete response: - msg = None - try: -- msg = run_sync(self.client.shell_channel.get_msg)(block=True, timeout=timeout) -+ kwargs = {"timeout": timeout} -+ if not JUPYTER_CLIENT_7: -+ kwargs["block"] = True -+ msg = run_sync(self.client.shell_channel.get_msg)(**kwargs) - except Empty: - warn('The kernel did not respond to an is_complete_request. ' - 'Setting `use_kernel_is_complete` to False.') diff --git a/84a4c63f7c2b700357f5e5f730209dc4fc897c24.patch b/84a4c63f7c2b700357f5e5f730209dc4fc897c24.patch deleted file mode 100644 index 56263c2..0000000 --- a/84a4c63f7c2b700357f5e5f730209dc4fc897c24.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 84a4c63f7c2b700357f5e5f730209dc4fc897c24 Mon Sep 17 00:00:00 2001 -From: David Brochart -Date: Wed, 2 Jun 2021 09:45:47 +0200 -Subject: [PATCH] Use run_sync only from jupyter_client 7.0+ - ---- - jupyter_console/completer.py | 12 +++++++++++- - jupyter_console/ptshell.py | 13 ++++++++++--- - 2 files changed, 21 insertions(+), 4 deletions(-) - -diff --git a/jupyter_console/completer.py b/jupyter_console/completer.py -index d0b7b9a..4b845e3 100644 ---- a/jupyter_console/completer.py -+++ b/jupyter_console/completer.py -@@ -7,6 +7,16 @@ - from traitlets.config import Configurable - from traitlets import Float - -+import jupyter_client -+ -+ -+# jupyter_client 7.0+ has async channel methods that we expect to be sync here -+if jupyter_client._version.version_info[0] >= 7: -+ from jupyter_client.utils import run_sync -+else: -+ run_sync = lambda x: x -+ -+ - class ZMQCompleter(Configurable): - """Client-side completion machinery. - -@@ -31,7 +41,7 @@ def complete_request(self, code, cursor_pos): - cursor_pos=cursor_pos, - ) - -- msg = self.client.shell_channel.get_msg(timeout=self.timeout) -+ msg = run_sync(self.client.shell_channel.get_msg)(timeout=self.timeout) - if msg['parent_header']['msg_id'] == msg_id: - return msg['content'] - -diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py -index d6dc1e7..4608992 100644 ---- a/jupyter_console/ptshell.py -+++ b/jupyter_console/ptshell.py -@@ -76,7 +76,14 @@ - from pygments.util import ClassNotFound - from pygments.token import Token - --from jupyter_client.utils import run_sync -+import jupyter_client -+ -+ -+# jupyter_client 7.0+ has async channel methods that we expect to be sync here -+if jupyter_client._version.version_info[0] >= 7: -+ from jupyter_client.utils import run_sync -+else: -+ run_sync = lambda x: x - - - def ask_yes_no(prompt, default=None, interrupt=None): -@@ -1034,6 +1041,6 @@ def double_int(sig, frame): - - # only send stdin reply if there *was not* another request - # or execution finished while we were reading. -- if not (self.client.stdin_channel.msg_ready() or -- self.client.shell_channel.msg_ready()): -+ if not (run_sync(self.client.stdin_channel.msg_ready)() or -+ run_sync(self.client.shell_channel.msg_ready)()): - self.client.input(raw_data) diff --git a/python-jupyter-console.spec b/python-jupyter-console.spec index bd1d917..4cb7392 100644 --- a/python-jupyter-console.spec +++ b/python-jupyter-console.spec @@ -6,7 +6,7 @@ %global srcname_ jupyter_console Name: python-%{srcname} -Version: 6.4.0 +Version: 6.4.2 Release: %autorelease Summary: Jupyter terminal console @@ -14,17 +14,6 @@ License: BSD URL: https://jupyter.org Source0: %pypi_source %{srcname_} -# Remove the loop parameter from asyncio.wait() -# Reported upstream in https://github.com/jupyter/jupyter_console/issues/245 -# Not backwards compatible with all older Pythons, downstream only for now -Patch1: python3.10.patch - -# Compatibility with jupyter-client 7 -# Patches from https://github.com/jupyter/jupyter_console/pull/244/ -Patch2: https://github.com/jupyter/jupyter_console/commit/0c7aca07d45ff009327599f6985c6a8ebbd98987.patch -Patch3: https://github.com/jupyter/jupyter_console/commit/84a4c63f7c2b700357f5e5f730209dc4fc897c24.patch -Patch4: https://github.com/jupyter/jupyter_console/commit/7f2dc911b41df9ed7f3cdc09a6832451cbe69d15.patch - BuildArch: noarch BuildRequires: python3-devel @@ -94,7 +83,7 @@ echo 'exit()' | jupyter-console --simple-prompt %files -n python-%{srcname}-doc %doc html -%license COPYING.md +%license LICENSE %changelog diff --git a/python3.10.patch b/python3.10.patch deleted file mode 100644 index 5638011..0000000 --- a/python3.10.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py -index a9daeed..0c1b51f 100644 ---- a/jupyter_console/ptshell.py -+++ b/jupyter_console/ptshell.py -@@ -661,7 +661,7 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable): - # wish to include external content - tasks.append(self.handle_external_iopub(loop=loop)) - -- main_task = asyncio.wait(tasks, loop=loop, return_when=asyncio.FIRST_COMPLETED) -+ main_task = asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED) - _, pending = loop.run_until_complete(main_task) - - for task in pending: diff --git a/sources b/sources index d949db3..9b508c1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (jupyter_console-6.4.0.tar.gz) = e2b301cfd3a56ee4cf33d5cfb297726d0f4478562167ed0f0a9320d389118fa661a85b6a5ef24db60673a76d84545bcdb9741bfdd9f8d13ccdbbc5c5e52d7227 +SHA512 (jupyter_console-6.4.2.tar.gz) = 8b52afb16c7571c745968b5f13fd96e4e594f68c0a0a11984373cf16c10aa82f0aaf2ec44e02dbbef784a0a391de940b380e8952876a4396a6bfcd36127f6038