You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies if this is the wrong place to ask this, I tried on the gitter but it doesn't seem particularly active.
I'm trying to create an embedded ipython with a custom async loop runner. My naive attempt is something like:
importIPythonfromtraitlets.configimportConfigc=Config()
c.InteractiveShell.loop_runner=print# not a real runner, but enough to debugIPython.embed(config=c)
but in the shell, get_ipython().loop_runner is still set to IPython.core.async_helpers._pseudo_sync_runner.
Am I setting the config wrongly, or is this config special and somehow harder to set?
importIPythondeftrio_runner(async_fn):
importtrioasyncdefloc(coro):
""" We need the dummy no-op async def to protect from trio's internal. See https://github.com/python-trio/trio/issues/89 """returnawaitcoroprint('Running with my runner')
returntrio.run(loc, async_fn)
IPython.embed(using=trio_runner)
$ python foo.py
Python 3.8.1 | packaged by conda-forge | (default, Jan 29 2020, 15:06:10)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.0.dev -- An enhanced Interactive Python. Type '?' for help.
In [1]: import trio
In [2]: await trio.sleep(1)
Running with my runner
In [3]:
embed() is a bit weird and overwrite the config because of nesting.
Apologies if this is the wrong place to ask this, I tried on the gitter but it doesn't seem particularly active.
I'm trying to create an embedded ipython with a custom async loop runner. My naive attempt is something like:
but in the shell,
get_ipython().loop_runner
is still set toIPython.core.async_helpers._pseudo_sync_runner
.Am I setting the config wrongly, or is this config special and somehow harder to set?
Possibly a duplicate of #10724
The text was updated successfully, but these errors were encountered: