pypi i cloup


Library to build command line interfaces (CLIs) based on and 100% compatible with Click. It's like using Click but with more built-in features: option groups, constraints (e.g. mutually exclusive params), command aliases, help themes, "did you mean ...?" suggestions and more.

by Gianluca Gippetto

2.0.0.post1 (see all)License:BSD 3-Clause
pypi i cloup

.. docs-index-start

.. |pypi-release| image:: :alt: Latest release on PyPI :target:

.. |tests-status| image:: :alt: Tests status :target:

.. |coverage| image:: :alt: Coverage Status :target:

.. |python-versions| image:: :alt: Supported versions :target:

.. |dev-docs| image:: :alt: Documentation Status (master branch) :target:

.. |release-docs| image:: :alt: Documentation Status (latest release) :target:

.. |downloads| image:: :alt: PyPI - Downloads :target:

.. |donate| image:: :alt: Donate with PayPal :target:



|pypi-release| |python-versions| |downloads| |tests-status| |coverage| |dev-docs| |donate|

Cloup — originally from "Cl\ick + option gr\ oup\s" — 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 to organize 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 ?" 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

.. code-block:: python

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(
        heading=Style(fg='bright_white', bold=True),

# In a multi-command app, you can pass formatter_settings as part
# of your context_settings so that they are propagated to subcommands.
    "Cool options",
    option('--foo', help='This text should describe the option --foo.'),
    option('--bar', help='This text should describe the option --bar.'),
    "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.'),
def cmd(**kwargs):
    """This is the command description."""

if __name__ == '__main__':

.. image:: :alt: Basic example --help screenshot

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

.. code-block:: text

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

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

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

Supporting the project

Designing, testing and documenting a library takes a lot of time. The most concrete way to show your appreciation and to support future development is by donating. Any amount is appreciated.


Apart from that, you can help the project by starring it on GitHub, reporting issues, proposing improvements and contributing with your code!

.. docs-index-end


  • Documentation (release | development)
  • Changelog <>_
  • GitHub repository <>_
  • Q&A and discussions <>_

.. _release: .. _development:


.. list-table::

* - |JetBrainsLogo|
  - A big thank to `JetBrains <>`_ for providing me with a free license for their IDEs.
    If you're developing a non-commercial open-source project, you may consider applying for a free license too.
    You find all details at `this link <>`_. Note that this license can be used only
    to develop non-commercial projects.

.. |JetBrainsLogo| image:: :alt: JetBrains logo :width: 250

3mos ago
3mos ago
3mos ago
4mos ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

No reviews found
Be the first to rate