Skip to content

Commit 288c74b

Browse files
authored
Merge pull request #457 from consideRatio/pr/declare-deps
List tornado and traitlets as dependencies explicitly, and cleanup unreachable code
2 parents 0b6669f + 0ecfdea commit 288c74b

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

.github/workflows/test.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
os: [ubuntu-22.04, windows-2022]
7777
python-version: ["3.8", "3.11"]
7878
pip-extras: ["lab", "classic"]
79+
pip-install-constraints: [""]
7980
exclude:
8081
# windows should work for all test variations, but a limited selection
8182
# is run to avoid doubling the amount of test runs
@@ -86,6 +87,17 @@ jobs:
8687
python-version: "3.8"
8788
pip-extras: lab
8889

90+
# this test is manually updated to reflect the lower bounds of
91+
# versions from dependencies
92+
- os: ubuntu-22.04
93+
python-version: "3.8"
94+
pip-extras: classic
95+
pip-install-constraints: >-
96+
jupyter-server==1.0
97+
simpervisor==1.0
98+
tornado==5.0
99+
traitlets==4.2.1
100+
89101
steps:
90102
- uses: actions/checkout@v4
91103

@@ -108,7 +120,7 @@ jobs:
108120
#
109121
# Pytest options are set in `pyproject.toml`.
110122
run: |
111-
pip install -vv $(ls ./dist/*.whl)\[acceptance,${{ matrix.pip-extras }}\]
123+
pip install -vv $(ls ./dist/*.whl)\[acceptance,${{ matrix.pip-extras }}\] ${{ matrix.pip-install-constraints }}
112124
113125
- name: List Python packages
114126
run: |

jupyter_server_proxy/websocket.py

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import inspect
88

99
from jupyter_server.utils import ensure_async
10-
from tornado import httpclient, httputil, ioloop, version_info, websocket
10+
from tornado import httpclient, httputil, websocket
1111

1212

1313
class PingableWSClientConnection(websocket.WebSocketClientConnection):
@@ -40,31 +40,21 @@ def pingable_ws_connect(
4040
request.headers = httputil.HTTPHeaders(request.headers)
4141
request = httpclient._RequestProxy(request, httpclient.HTTPRequest._DEFAULTS)
4242

43-
# for tornado 4.5.x compatibility
44-
if version_info[0] == 4:
45-
conn = PingableWSClientConnection(
46-
io_loop=ioloop.IOLoop.current(),
47-
compression_options={},
48-
request=request,
49-
on_message_callback=on_message_callback,
50-
on_ping_callback=on_ping_callback,
51-
)
52-
else:
53-
# resolver= parameter requires tornado >= 6.3. Only pass it if needed
54-
# (for Unix socket support), so older versions of tornado can still
55-
# work otherwise.
56-
kwargs = {"resolver": resolver} if resolver else {}
57-
conn = PingableWSClientConnection(
58-
request=request,
59-
compression_options={},
60-
on_message_callback=on_message_callback,
61-
on_ping_callback=on_ping_callback,
62-
max_message_size=getattr(
63-
websocket, "_default_max_message_size", 10 * 1024 * 1024
64-
),
65-
subprotocols=subprotocols,
66-
**kwargs,
67-
)
43+
# resolver= parameter requires tornado >= 6.3. Only pass it if needed
44+
# (for Unix socket support), so older versions of tornado can still
45+
# work otherwise.
46+
kwargs = {"resolver": resolver} if resolver else {}
47+
conn = PingableWSClientConnection(
48+
request=request,
49+
compression_options={},
50+
on_message_callback=on_message_callback,
51+
on_ping_callback=on_ping_callback,
52+
max_message_size=getattr(
53+
websocket, "_default_max_message_size", 10 * 1024 * 1024
54+
),
55+
subprotocols=subprotocols,
56+
**kwargs,
57+
)
6858

6959
return conn.connect_future
7060

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ dependencies = [
5050
"importlib_metadata >=4.8.3 ; python_version<\"3.10\"",
5151
"jupyter-server >=1.0",
5252
"simpervisor >=1.0",
53+
"tornado >=5.0",
54+
"traitlets >= 4.2.1",
5355
]
5456

5557
[project.optional-dependencies]

0 commit comments

Comments
 (0)