diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 16d6766b..dd75d559 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -76,6 +76,7 @@ jobs: os: [ubuntu-22.04, windows-2022] python-version: ["3.8", "3.11"] pip-extras: ["lab", "classic"] + pip-install-constraints: [""] exclude: # windows should work for all test variations, but a limited selection # is run to avoid doubling the amount of test runs @@ -86,6 +87,17 @@ jobs: python-version: "3.8" pip-extras: lab + # this test is manually updated to reflect the lower bounds of + # versions from dependencies + - os: ubuntu-22.04 + python-version: "3.8" + pip-extras: classic + pip-install-constraints: >- + jupyter-server==1.0 + simpervisor==1.0 + tornado==5.0 + traitlets==4.2.1 + steps: - uses: actions/checkout@v4 @@ -108,7 +120,7 @@ jobs: # # Pytest options are set in `pyproject.toml`. run: | - pip install -vv $(ls ./dist/*.whl)\[acceptance,${{ matrix.pip-extras }}\] + pip install -vv $(ls ./dist/*.whl)\[acceptance,${{ matrix.pip-extras }}\] ${{ matrix.pip-install-constraints }} - name: List Python packages run: | diff --git a/jupyter_server_proxy/websocket.py b/jupyter_server_proxy/websocket.py index 8a9a9bd6..a43b7795 100644 --- a/jupyter_server_proxy/websocket.py +++ b/jupyter_server_proxy/websocket.py @@ -7,7 +7,7 @@ import inspect from jupyter_server.utils import ensure_async -from tornado import httpclient, httputil, ioloop, version_info, websocket +from tornado import httpclient, httputil, websocket class PingableWSClientConnection(websocket.WebSocketClientConnection): @@ -40,31 +40,21 @@ def pingable_ws_connect( request.headers = httputil.HTTPHeaders(request.headers) request = httpclient._RequestProxy(request, httpclient.HTTPRequest._DEFAULTS) - # for tornado 4.5.x compatibility - if version_info[0] == 4: - conn = PingableWSClientConnection( - io_loop=ioloop.IOLoop.current(), - compression_options={}, - request=request, - on_message_callback=on_message_callback, - on_ping_callback=on_ping_callback, - ) - else: - # resolver= parameter requires tornado >= 6.3. Only pass it if needed - # (for Unix socket support), so older versions of tornado can still - # work otherwise. - kwargs = {"resolver": resolver} if resolver else {} - conn = PingableWSClientConnection( - request=request, - compression_options={}, - on_message_callback=on_message_callback, - on_ping_callback=on_ping_callback, - max_message_size=getattr( - websocket, "_default_max_message_size", 10 * 1024 * 1024 - ), - subprotocols=subprotocols, - **kwargs, - ) + # resolver= parameter requires tornado >= 6.3. Only pass it if needed + # (for Unix socket support), so older versions of tornado can still + # work otherwise. + kwargs = {"resolver": resolver} if resolver else {} + conn = PingableWSClientConnection( + request=request, + compression_options={}, + on_message_callback=on_message_callback, + on_ping_callback=on_ping_callback, + max_message_size=getattr( + websocket, "_default_max_message_size", 10 * 1024 * 1024 + ), + subprotocols=subprotocols, + **kwargs, + ) return conn.connect_future diff --git a/pyproject.toml b/pyproject.toml index 37fe1119..2a1e1ad8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,8 @@ dependencies = [ "importlib_metadata >=4.8.3 ; python_version<\"3.10\"", "jupyter-server >=1.0", "simpervisor >=1.0", + "tornado >=5.0", + "traitlets >= 4.2.1", ] [project.optional-dependencies]