ipykernel disallows jupyter user to create/attach to event loop
- 主要语言
- Python
- 星标
- 734
- 派生
- 412
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 8
描述
Hello,
as follow-up on https://github.com/jupyter/notebook/issues/3397#issuecomment-419474214, here a minimal example that I expect to finish successfully when sent to the kernel by jupyter:
```py
import asyncio
print(asyncio.get_event_loop().run_until_complete(asyncio.sleep(0)))
```
It runs fine in latest IPython which doesn't use tornado under the hood.
However, `notebook>=5.7.9` requires `tornado>=5` and so when ipykernel executes `loop = tornado.ioloop.IOLoop.current()`, an asyncio event loop will be created and `run_forever` by ipykernel.
This consequently leaves the user without options (left aside `nest-asyncio` which works for most cases), as there is a running asyncio loop on startup.
If IPython can run this simple snippet, shouldn't jupyter be able to do the same? Currently, any package that does a plain loop setup and teardown will crash in jupyter envs that have `tornado>=5`.
贡献指南
调研方向
Reproduce the issue in a Jupyter environment using notebook>=5.7.9 and tornado>=5, starting with the asyncio snippet in the report. Inspect ipykernel's use of tornado.ioloop.IOLoop.current() and its run_forever behavior. Done means the snippet can create, run, and tear down its event loop successfully when sent to the kernel.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- jupyter, python
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100