ipython / ipython/ipykernel

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

Aperta
#1,243 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
734
Fork
412
Merge medio
1g 5h
PR unite (30g)
8

Descrizione

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...

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
jupyter, python
Ambito
backend, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.