Install & Compatibility
Where this runs
tested against v8.3.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.080s · 18.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.076s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
command
✓ from asyncclick import command
✗ from click import command
Asyncclick replaces the standard Click imports for async functionality. Do not mix imports from `click` and `asyncclick` in the same program.
group
✓ from asyncclick import group
✗ from click import group
Asyncclick replaces the standard Click imports for async functionality. Do not mix imports from `click` and `asyncclick` in the same program.
option
✓ from asyncclick import option
✗ from click import option
Asyncclick replaces the standard Click imports for async functionality. Do not mix imports from `click` and `asyncclick` in the same program.
echo
✓ from asyncclick import echo
✗ from click import echo
Asyncclick replaces the standard Click imports for async functionality. Do not mix imports from `click` and `asyncclick` in the same program.
click (alias)
✓ import asyncclick as click
✗ import click
When migrating from Click, replace `import click` with `import asyncclick as click` to seamlessly use async-enabled handlers. Mixing direct imports is not supported.
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()
asyncclick --version
Debug
Known issues
breaking`asyncclick.prompt` is now asynchronous and must be awaited. It also introduces a `blocking` parameter.fixEnsure all calls to `asyncclick.prompt` are prefixed with `await`. Consider the `blocking` parameter if dealing with interrupt handling.
affects: 8.3.0 and newer
breaking`Context.exit` has been renamed to `Context.aexit` and is now an asynchronous method.fixReplace `Context.exit` calls with `await Context.aexit` to correctly handle asynchronous teardown callbacks and context managers.
affects: 8.3.0 and newer
gotchaDo not mix direct imports from the synchronous `click` library and `asyncclick` in the same program.fixReplace `import click` with `import asyncclick as click` and ensure all decorators and functions (`command`, `option`, `group`, `echo`, etc.) are imported from `asyncclick`.
affects: All versions
gotchaPerforming blocking synchronous I/O or CPU-bound operations directly in `async` command handlers will block the event loop, negating the benefits of async programming.fixFor CPU-bound tasks, use `anyio.to_thread.run_sync()` or `asyncio.to_thread()` (or `loop.run_in_executor` for older `asyncio`) to offload work to a thread pool. For blocking I/O, use async-native libraries (e.g., `aiohttp` instead of `requests`).
affects: All versions
deprecatedAsyncclick inherits deprecations from upstream Click. For example, `BaseCommand` and `MultiCommand` are deprecated in favor of `Command` and `Group` respectively, and the `__version__` attribute is deprecated in favor of `importlib.metadata.version("click")`.fixConsult the Click 8.x changelog for specific deprecations. Prefer using `Command` and `Group` for base classes and `importlib.metadata.version` for version retrieval.
affects: 8.3.0 and newer (inherited from Click 8.3.0)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'asyncclick'
The 'asyncclick' module is not installed in the current Python environment.
fixInstall the module using 'pip install asyncclick'.
ImportError: cannot import name 'AsyncClient' from 'binance.client'
The 'AsyncClient' class is not available in the 'binance.client' module, possibly due to an outdated package version.
fixUpdate the Binance API package to the latest version using 'pip install --upgrade python-binance'.
ModuleNotFoundError: No module named 'click'
The 'click' module is not installed in the current Python environment.
fixInstall the module using 'pip install click'.
RuntimeWarning: coroutine was never awaited
This warning appears when an `async def` function (coroutine), such as an asyncclick command or callback, is called but its execution is not scheduled on the event loop, often by forgetting to `await` it or by not correctly invoking the asyncclick command runner.
fixEnsure all async functions are `await`ed where appropriate, and that your asyncclick application's entry point is correctly set up to run the command in an event loop, for example, by calling `your_command_group()` at the module level or `your_command_group(_anyio_backend="asyncio")`.
TypeError: 'coroutine' object is not callable
This error happens when an `async def` function is called without `await` in a context where a callable object is expected, or if the returned coroutine object is then mistakenly treated as if it were the actual return value or a directly executable function.
fixIf calling an asyncclick command programmatically, ensure you `await` it within an `async` context. If it's the main entry point, ensure `asyncclick`'s command runner is properly invoked (e.g., `my_command()` if defined at the top level, which `asyncclick` handles to run in an event loop).
Upgrade
Version history
8.4.2.1latest on PyPI · released Jun 30, 2026
Audit
Dependencies
clickrequiredasyncclick is a fork of Click and shares much of its underlying structure. While you import from `asyncclick`, `click` is an implicit dependency.
anyiorequiredProvides the async compatibility layer, allowing asyncclick to work with both asyncio and Trio event loops. Explicitly used in examples to run the CLI asynchronously.
pythonrequiredRequires Python 3.11 or newer for the latest version.