-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove usages of tornado io_loop in favor of native asyncio #1362
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Actually, we could still expose an |
👍 to switching all internal use to asyncio. There's little to no cost in keeping |
Good idea, thanks! |
Problem
Tornado's
io_loop
is now a wrapper around the nativeasyncio
loop, and the tornado docs recommend usingasyncio
andasyncio.run()
directly. In addition, there are plans to deprecate and removeasyncio.set_event_loop_policy
, meaning that the we would have to use theloop_factory
parameter that was added in Python 3.12.We still want to use the
SelectorEventLoop
on Windows when using tornado, because even though it supportsProactorEventLoop
as of tornado 6.1, it is less efficient, because it is using selectors in a thread.Because
ServerApp.io_loop
is a public property, we'll have to bump to 3.0, because it is used by at leastjupyterlab
in a couple of places in tests (see below). We may also want to change it so that we start the event loop earlier, maybe inlaunch_instance
.Proposed Solution
We should remove usages of
tornadio.io_loop
up and down the stack, and add convenience function(s) injupyter_core.utils
to handle starting an event loop for different versions of Python, and perhaps a replacement forPeriodicCallback
.I will start by working on a PR to
jupyter_client
that replaces usages ofZMQStream
.Additional context
Known usages:
jupyter_server
:add_callback_from_signal
,add_callback
,start
, andstop
, all internal usages, butio_loop
is technically a public property.jupyter_client
: usesZMQStream
, which we'll need a replacement for. This seems to be the biggest remaining lift.ipykernel
: will be partially removed by Replace Tornado with AnyIO ipython/ipykernel#1079, but there are still usages injupyter_client/ioloop
.jupyterlab
:browser_check.py
andjupyterlab/tests/test_app.py
both useapp.io_loop
qtconsole
: we'll be able to remove the_init_asyncio_patch
shim once it depends on a version ofjupyter_client
that doesn't useZMQStream
inkernel_client.start_channels()
.The text was updated successfully, but these errors were encountered: