Skip to main content

aioconsole

Asynchronous console and interfaces for asyncio

aioconsole provides:

  • asynchronous equivalents to input, print, exec and code.interact

  • an interactive loop running the asynchronous python console

  • a way to customize and run command line interface using argparse

  • stream support to serve interfaces instead of using standard streams

  • the apython script to access asyncio code at runtime without modifying the sources

⚠️ Limitations

Better alternative to aioconsole.ainput()

A common use case for aioconsole is the async alternative to the builtin input function. However, aioconsole was written in 2015 and since then the powerful prompt-toolkit library has gained better asyncio support. The recommended way to prompt in an asyncio application is now to use the prompt-toolkit library:

from prompt_toolkit import PromptSession
from prompt_toolkit.patch_stdout import patch_stdout

async def my_coroutine():
   session = PromptSession()
   while True:
      with patch_stdout():
            result = await session.prompt_async("Say something: ")
      print(f"You said: {result}")

Better python consoles with async support

The python console exposed by aioconsole is quite limited compared to modern consoles such as IPython or ptpython. Luckily, those projects gained greater asyncio support over the years. In particular, the following use cases overlap with aioconsole capabilities:

Requirements

  • Python >= 3.10.3

Installation

aioconsole is available on PyPI and GitHub. Both of the following commands install the aioconsole package and the apython script.

$ pip3 install aioconsole   # from PyPI
$ python3 setup.py install  # or from the sources
$ apython -h
usage: apython [-h] [--serve [HOST:] PORT] [--no-readline]
               [--banner BANNER] [--locals LOCALS]
               [-m MODULE | FILE] ...

Run the given python file or module with a modified asyncio policy replacing
the default event loop with an interactive loop. If no argument is given, it
simply runs an asynchronous python console.

positional arguments:
  FILE                  python file to run
  ARGS                  extra arguments

optional arguments:
  -h, --help            show this help message and exit
  --serve [HOST:] PORT, -s [HOST:] PORT
                        serve a console on the given interface instead
  --no-readline         force readline disabling
  --banner BANNER       provide a custom banner
  --locals LOCALS       provide custom locals as a dictionary
  -m MODULE             run a python module

Simple usage

The following example demonstrates the use of await inside the console:

$ apython
Python 3.5.0 (default, Sep 7 2015, 14:12:03)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
---
This console is running in an asyncio event loop.
It allows you to wait for coroutines using the 'await' syntax.
Try: await asyncio.sleep(1, result=3, loop=loop)
---
>>> await asyncio.sleep(1, result=3)
# Wait one second...
3
>>>

Documentation

Find more examples in the documentation and the example directory.

Contact

Vincent Michel: vxgmichel@gmail.com

Metadata

Release files for aioconsole 0.9.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 aioconsole 0.9.0
File Size Uploaded Provenance Actions
aioconsole-0.9.0.tar.gz 38.2 kB With provenance Details for aioconsole-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aioconsole 0.9.0
File Interpreter ABI Platform Actions
aioconsole-0.9.0-py3-none-any.whl Python 3 none any Details for aioconsole-0.9.0-py3-none-any.whl

Total release size: 69.6 kB

Release files / aioconsole-0.9.0.tar.gz

Download URL aioconsole-0.9.0.tar.gz
Size 38.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f60483fc28b72789cc092c2738c30a9b63cd6468ac4092feffda997d6ad91841
BLAKE2b-256 checksum
How to use checksums
7c89c326812c036444aa9adc32278a0dc6a73d2af60d2a460ac604860d2c431b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Release files / aioconsole-0.9.0-py3-none-any.whl

Download URL aioconsole-0.9.0-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cac65f68bd73fa494e3a4442d79bee7a643ccf4c2f852e5ca07700f98759e6a5
BLAKE2b-256 checksum
How to use checksums
37ca5322d34cdcc37947561a828038de66a24e075615e2dda204f8f8ef7c3e61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Security for aioconsole 0.9.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aioconsole-0.9.0.tar.gz

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 Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files Full provenance

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