Skip to main content

An extension for IPython that help to run AsyncIO code in your interactive session.

Project description

An extension for IPython that help to run AsyncIO code in your interactive session.

Based on Gist.


Install asyncio-ipython-magic using pip:

$ pip install asyncio-ipython-magic

…or directly from the repository using the %install_ext magic command:

$ In[1]: %install_ext



In [1]: %load_ext asynciomagic

In [2]: import asyncio

In [3]: import time

In [4]: async def foo():
   ...:     i = 0
   ...:     while i < 3:
   ...:         print('time =', time.time())
   ...:         i += 1
   ...:         await asyncio.sleep(2)

In [5]: %%async_
   ...: await foo()
time = 1478985421.307329
time = 1478985423.309606
time = 1478985425.31514

In [6]: %await_ foo()
time = 1487097377.700184
time = 1487097379.705614
time = 1487097381.707186

In [7]:


It just works, I hope.


asyncio-ipython-magic is licensed under the MIT license. See the license file for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for asyncio-ipython-magic, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size asyncio_ipython_magic-0.0.3-py2.py3-none-any.whl (4.7 kB) File type Wheel Python version 3.6 Upload date Hashes View
Filename, size asyncio-ipython-magic-0.0.3.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page