ipython / ipython/ipykernel

Using the `--IPKernelApp.trio_loop=True` doesn't appear to set the main loop to use `trio`

Đang mở
#1,243 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
734
Fork
412
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
8

Mô tả

To reproduce:

```
% ipython --IPKernelApp.trio_loop=True
Python 3.11.6 | packaged by conda-forge | (main, Oct 3 2023, 10:37:07) [Clang 15.0.7 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.24.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import trio

In [2]: await trio.sleep(1)
...
RuntimeError: must be called from async context
```

However the following does work, which is not expected:

```
% ipython --IPKernelApp.trio_loop=True
Python 3.11.6 | packaged by conda-forge | (main, Oct 3 2023, 10:37:07) [Clang 15.0.7 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.24.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import asyncio

In [2]: await asyncio.sleep(1)

In [3]:
```

I could have missed something obvious though...

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Reproduce the command with --IPKernelApp.trio_loop=True and compare the trio and asyncio await cases. Trace how ipykernel handles the trio_loop setting and identify why trio.sleep is outside an async context; done means trio awaits work under the flag and the observed asyncio behavior matches the intended semantics.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
jupyter, python
Lĩnh vực
backend, devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.