From 5878e1235629991b3971e7db09beb5c8489d724f Mon Sep 17 00:00:00 2001 From: David Brochart Date: Thu, 24 Nov 2022 15:18:32 +0100 Subject: [PATCH 1/4] Import ensure_async from jupyter_core --- jupyter_server/utils.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/jupyter_server/utils.py b/jupyter_server/utils.py index 5823321e7a..3a1ebd24d6 100644 --- a/jupyter_server/utils.py +++ b/jupyter_server/utils.py @@ -3,7 +3,6 @@ # Distributed under the terms of the Modified BSD License. import errno import importlib.util -import inspect import os import socket import sys @@ -14,6 +13,7 @@ from urllib.request import pathname2url # noqa: F401 from _frozen_importlib_external import _NamespacePath +from jupyter_core.utils import ensure_async # noqa: F401 from packaging.version import Version from tornado.httpclient import AsyncHTTPClient, HTTPClient, HTTPRequest from tornado.netutil import Resolver @@ -173,23 +173,6 @@ def _check_pid_posix(pid): check_pid = _check_pid_posix -async def ensure_async(obj): - """Convert a non-awaitable object to a coroutine if needed, - and await it if it was not already awaited. - """ - if inspect.isawaitable(obj): - try: - result = await obj - except RuntimeError as e: - if str(e) == "cannot reuse already awaited coroutine": - # obj is already the coroutine's result - return obj - raise - return result - # obj doesn't need to be awaited - return obj - - async def run_sync_in_loop(maybe_async): """**DEPRECATED**: Use ``ensure_async`` instead.""" warnings.warn( From 359a7944b6eb2271cd4179f38f4443e27092c9ca Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 28 Nov 2022 07:40:49 -0600 Subject: [PATCH 2/4] bump jupyter_core dep --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 713ec1346f..db5db9efb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ "argon2-cffi", "jinja2", "jupyter_client>=7.4.4", - "jupyter_core>=4.9.2", + "jupyter_core>=4.12", "jupyter_server_terminals", "nbconvert>=6.4.4", "nbformat>=5.2.0", From f945058a548b0b50377a642c95111b2e0b87591d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 28 Nov 2022 17:31:13 -0600 Subject: [PATCH 3/4] try dep --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index db5db9efb4..92f90cccfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ "argon2-cffi", "jinja2", "jupyter_client>=7.4.4", - "jupyter_core>=4.12", + "jupyter_core>=4.12!~5.0", "jupyter_server_terminals", "nbconvert>=6.4.4", "nbformat>=5.2.0", From bb1409d6b68f8328e3114661ba76f5e43d55f428 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 28 Nov 2022 20:15:56 -0600 Subject: [PATCH 4/4] update constraint --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 92f90cccfc..7877b816a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ "argon2-cffi", "jinja2", "jupyter_client>=7.4.4", - "jupyter_core>=4.12!~5.0", + "jupyter_core>=4.12,!=~5.0", "jupyter_server_terminals", "nbconvert>=6.4.4", "nbformat>=5.2.0",