Skip to main content

Overview

Latest release on PyPI

AsyncCloup is a Cloup fork that works with AsyncClick <https://github.com/python-trio/asyncclick> instead of Click. This should be a drop-in change.

Cloup — originally from “Click + option groups” — enriches Click with several features that make it more expressive and configurable:

  • option groups and an (optional) help section for positional arguments

  • constraints, like mutually_exclusive, that can be applied to option groups or to any group of parameters, even conditionally

  • subcommand aliases

  • subcommands sections, i.e. the possibility of organizing the subcommands of a Group in multiple help sections

  • a themeable HelpFormatter that:

    • has more parameters for adjusting widths and spacing, which can be provided at the context and command level

    • use a different layout when the terminal width is below a certain threshold in order to improve readability

  • suggestions like “did you mean <subcommand>?” when you mistype a subcommand.

Moreover, Cloup improves on IDE support providing decorators with detailed type hints and adding the static methods Context.settings() and HelpFormatter.settings() for creating dictionaries of settings.

Cloup is statically type-checked with MyPy in strict mode and extensively tested against multiple versions of Python with nearly 100% coverage.

A simple example

from cloup import (
    HelpFormatter, HelpTheme, Style,
    command, option, option_group
)
from cloup.constraints import RequireAtLeast, mutually_exclusive

# Check the docs for all available arguments of HelpFormatter and HelpTheme.
formatter_settings = HelpFormatter.settings(
    theme=HelpTheme(
        invoked_command=Style(fg='bright_yellow'),
        heading=Style(fg='bright_white', bold=True),
        constraint=Style(fg='magenta'),
        col1=Style(fg='bright_yellow'),
    )
)

# In a multi-command app, you can pass formatter_settings as part
# of your context_settings so that they are propagated to subcommands.
@command(formatter_settings=formatter_settings)
@option_group(
    "Cool options",
    option('--foo', help='This text should describe the option --foo.'),
    option('--bar', help='This text should describe the option --bar.'),
    constraint=mutually_exclusive,
)
@option_group(
    "Other cool options",
    "This is the optional description of this option group.",
    option('--pippo', help='This text should describe the option --pippo.'),
    option('--pluto', help='This text should describe the option --pluto.'),
    constraint=RequireAtLeast(1),
)
async def cmd(**kwargs):
    """This is the command description."""
    await anyio.sleep(1)

if __name__ == '__main__':
    cmd(prog_name='invoked-command')
Basic example --help screenshot

If you don’t provide --pippo or --pluto:

Usage: invoked-command [OPTIONS]
Try 'invoked-command --help' for help.

Error: at least 1 of the following parameters must be set:
  --pippo
  --pluto

This simple example just scratches the surface. Read more in the documentation (links below).

Release files for asynccloup 3.0.8.2

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

Source distribution (sdist)

Source distribution for asynccloup 3.0.8.2
File Size Uploaded
asynccloup-3.0.8.2.tar.gz 230.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asynccloup 3.0.8.2
File Interpreter ABI Platform
asynccloup-3.0.8.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 285.3 kB

Release files / asynccloup-3.0.8.2.tar.gz

Download URL asynccloup-3.0.8.2.tar.gz
Size 230.2 kB
Tags Source
SHA-256 checksum
How to use checksums
20ebd70b652540ae086e984b4db432c5bda1a3a86c0731148a529eae9cd3984f
BLAKE2b-256 checksum
How to use checksums
16a018c90badff70ad2ad41ce3a7d927daf24b6c9dfffa51252283c31cdd1005
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / asynccloup-3.0.8.2-py2.py3-none-any.whl

Download URL asynccloup-3.0.8.2-py2.py3-none-any.whl
Size 55.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a5d5507e3fca458dbafb74028d0ee223816a8edc99df651a113547d818f502dc
BLAKE2b-256 checksum
How to use checksums
505ad3353cde4402b230be3727c9882609db14a09a4c03e3a5169d84e4de1661
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

3.0.8.2 This release

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