Skip to main content

ipython-smart-await

Auto-await coroutine results in the IPython REPL — drive a pure-async API without typing await everywhere.

When loaded, the extension rewrites each input cell so that expressions which evaluate to a coroutine are awaited automatically on IPython's loop runner.

Install

pip install ipython-smart-await

Usage

%load_ext smart_await

Then, given some async API bound to p:

p.get_pid()          # -> awaited automatically (no `await` needed)
a[0]                 # -> awaited if `a.__getitem__` returns a coroutine
a[0] = 7             # -> routed to `a.setindex(0, 7)` (awaited) when `a` has an async `setindex`
proxy.length         # -> awaited if attribute access returns a coroutine (dynamic proxies)

Opting out

Wrap a call in ...( ) to get the raw, un-awaited value:

coro = ...(p.get_pid())   # `coro` is the coroutine itself

Cells that already use await / async constructs are left untouched.

How it works

The extension installs an ast transformer (an IPython AST transformer) that wraps:

  • calls (foo()), subscript reads (a[0]), and attribute reads (a.b) in a helper that awaits the result only if it is a coroutine (non-coroutines pass through unchanged);
  • single-target subscript assignment (a[0] = v) into a call that routes to an async setindex(key, value) when the target exposes one, otherwise a normal item assignment — so dicts, lists, numpy arrays, etc. are unaffected.

License

MIT

Metadata

Release files for ipython-smart-await 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipython-smart-await 0.3.0
File Size Uploaded
ipython_smart_await-0.3.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ipython-smart-await 0.3.0
File Interpreter ABI Platform
ipython_smart_await-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / ipython_smart_await-0.3.0.tar.gz

Download URL ipython_smart_await-0.3.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b5fbe492f700aa6c6696a2791b4b0aaa82d0c98813ef837ae3c1221a4c23f147
BLAKE2b-256 checksum
How to use checksums
923d163c633d7dcee44251066137b34902f1686582ec3c230d29ed325505c311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.

Transparency log

Release files / ipython_smart_await-0.3.0-py3-none-any.whl

Download URL ipython_smart_await-0.3.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfaf6ae7016e6f1c51631cd1a2b02338b5e9c9a4b969944ba87fb2dbbd05343f
BLAKE2b-256 checksum
How to use checksums
c22606740ce08af480038e650f25a93f8071f84936f581d85947e74720b7682d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page