Async Click

8.3.0.7 · active · verified Sat Apr 11

Asyncclick is a fork of Click that works seamlessly with Trio or asyncio, enabling the use of asynchronous command and subcommand handlers for building composable command line interfaces. It aims to provide the familiar Click API with added async capabilities. The current version is 8.3.0.7, released on October 11, 2025, and generally follows the upstream Click project's release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic asynchronous command using `asyncclick`. It defines a command with options and arguments, and includes an `await` call to simulate an asynchronous operation, showcasing `asyncclick`'s core functionality.

import asyncclick as click
import anyio

@click.command()
@click.option("--count", default=1, help="Number of greetings.")
@click.option("--name", prompt="Your name", help="The person to greet.")
async def hello(count, name):
    """Simple program that greets NAME for a total of COUNT times."""
    for _ in range(count):
        click.echo(f"Hello, {name}!")
        await anyio.sleep(0.1) # Simulate async I/O

if __name__ == '__main__':
    # asyncclick automatically starts an anyio event loop
    # and runs your code asynchronously.
    hello()

view raw JSON →