.. docs-index-start
.. |pypi-release| image:: https://img.shields.io/pypi/v/cloup.svg
:alt: Latest release on PyPI
:target: https://pypi.org/project/cloup/
.. |tests-status| image:: https://github.com/janLuke/cloup/workflows/Tests/badge.svg
:alt: Tests status
:target: https://github.com/janLuke/cloup/actions?query=workflow%3ATests
.. |coverage| image:: https://codecov.io/github/janLuke/cloup/coverage.svg?branch=master
:alt: Coverage Status
:target: https://app.codecov.io/github/janluke/cloup/tree/master
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/cloup.svg
:alt: Supported versions
:target: https://pypi.org/project/cloup
.. |dev-docs| image:: https://readthedocs.org/projects/cloup/badge/?version=latest
:alt: Documentation Status (master branch)
:target: https://cloup.readthedocs.io/en/latest/
.. |release-docs| image:: https://readthedocs.org/projects/cloup/badge/?version=stable
:alt: Documentation Status (latest release)
:target: https://cloup.readthedocs.io/en/stable/
.. |downloads| image:: https://static.pepy.tech/personalized-badge/cloup?period=week&units=international_system&left_color=grey&right_color=blue&left_text=downloads%20/%20week
:alt: PyPI - Downloads
:target: https://pepy.tech/project/cloup
========
Overview
========
|pypi-release| |downloads| |tests-status| |coverage| |dev-docs|
**Cloup** — originally from "**Cl**\ick + option gr\ **oup**\s" — enriches
`Click <https://github.com/pallets/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
================
.. 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(
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),
)
def cmd(**kwargs):
"""This is the command description."""
pass
if __name__ == '__main__':
cmd(prog_name='invoked-command')
.. image:: https://raw.githubusercontent.com/janLuke/cloup/master/docs/_static/basic-example.png
: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:
--pippo
--pluto
This simple example just scratches the surface. Read more in the documentation
(links below).
.. docs-index-end
Links
=====
* Documentation (release_ | development_)
* `Changelog <https://cloup.readthedocs.io/en/stable/pages/changelog.html>`_
* `GitHub repository <https://github.com/janLuke/cloup>`_
* `Q&A and discussions <https://github.com/janLuke/cloup/discussions>`_
.. _release: https://cloup.readthedocs.io/en/stable/#user-guide
.. _development: https://cloup.readthedocs.io/en/latest/#user-guide
Raw data
{
"_id": null,
"home_page": "https://github.com/janLuke/cloup",
"name": "cloup",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "CLI, click, argument groups, option groups, constraints, help colors, help themes, help styles",
"author": "Gianluca Gippetto",
"author_email": "gianluca.gippetto@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/46/cf/09a31f0f51b5c8ef2343baf37c35a5feb4f6dfdcbd0592a014baf837f2e4/cloup-3.0.8.tar.gz",
"platform": null,
"description": ".. docs-index-start\n\n.. |pypi-release| image:: https://img.shields.io/pypi/v/cloup.svg\n :alt: Latest release on PyPI\n :target: https://pypi.org/project/cloup/\n\n.. |tests-status| image:: https://github.com/janLuke/cloup/workflows/Tests/badge.svg\n :alt: Tests status\n :target: https://github.com/janLuke/cloup/actions?query=workflow%3ATests\n\n.. |coverage| image:: https://codecov.io/github/janLuke/cloup/coverage.svg?branch=master\n :alt: Coverage Status\n :target: https://app.codecov.io/github/janluke/cloup/tree/master\n\n.. |python-versions| image:: https://img.shields.io/pypi/pyversions/cloup.svg\n :alt: Supported versions\n :target: https://pypi.org/project/cloup\n\n.. |dev-docs| image:: https://readthedocs.org/projects/cloup/badge/?version=latest\n :alt: Documentation Status (master branch)\n :target: https://cloup.readthedocs.io/en/latest/\n\n.. |release-docs| image:: https://readthedocs.org/projects/cloup/badge/?version=stable\n :alt: Documentation Status (latest release)\n :target: https://cloup.readthedocs.io/en/stable/\n\n.. |downloads| image:: https://static.pepy.tech/personalized-badge/cloup?period=week&units=international_system&left_color=grey&right_color=blue&left_text=downloads%20/%20week\n :alt: PyPI - Downloads\n :target: https://pepy.tech/project/cloup\n\n========\nOverview\n========\n|pypi-release| |downloads| |tests-status| |coverage| |dev-docs|\n\n**Cloup** \u2014 originally from \"**Cl**\\ick + option gr\\ **oup**\\s\" \u2014 enriches\n`Click <https://github.com/pallets/click>`_ with several features that make it\nmore expressive and configurable:\n\n- **option groups** and an (optional) help section for positional arguments\n\n- **constraints**, like ``mutually_exclusive``, that can be applied to option groups\n or to any group of parameters, even *conditionally*\n\n- **subcommand aliases**\n\n- **subcommands sections**, i.e. the possibility of organizing the subcommands of a\n ``Group`` in multiple help sections\n\n- a **themeable HelpFormatter** that:\n\n - has more parameters for adjusting widths and spacing, which can be provided\n at the context and command level\n - use a different layout when the terminal width is below a certain threshold\n in order to improve readability\n\n- suggestions like \"did you mean <subcommand>?\" when you mistype a subcommand.\n\nMoreover, Cloup improves on **IDE support** providing decorators with *detailed*\ntype hints and adding the static methods ``Context.settings()`` and\n``HelpFormatter.settings()`` for creating dictionaries of settings.\n\nCloup is **statically type-checked** with MyPy in strict mode and extensively **tested**\nagainst multiple versions of Python with nearly 100% coverage.\n\n\nA simple example\n================\n\n.. code-block:: python\n\n from cloup import (\n HelpFormatter, HelpTheme, Style,\n command, option, option_group\n )\n from cloup.constraints import RequireAtLeast, mutually_exclusive\n\n # Check the docs for all available arguments of HelpFormatter and HelpTheme.\n formatter_settings = HelpFormatter.settings(\n theme=HelpTheme(\n invoked_command=Style(fg='bright_yellow'),\n heading=Style(fg='bright_white', bold=True),\n constraint=Style(fg='magenta'),\n col1=Style(fg='bright_yellow'),\n )\n )\n\n # In a multi-command app, you can pass formatter_settings as part\n # of your context_settings so that they are propagated to subcommands.\n @command(formatter_settings=formatter_settings)\n @option_group(\n \"Cool options\",\n option('--foo', help='This text should describe the option --foo.'),\n option('--bar', help='This text should describe the option --bar.'),\n constraint=mutually_exclusive,\n )\n @option_group(\n \"Other cool options\",\n \"This is the optional description of this option group.\",\n option('--pippo', help='This text should describe the option --pippo.'),\n option('--pluto', help='This text should describe the option --pluto.'),\n constraint=RequireAtLeast(1),\n )\n def cmd(**kwargs):\n \"\"\"This is the command description.\"\"\"\n pass\n\n if __name__ == '__main__':\n cmd(prog_name='invoked-command')\n\n\n.. image:: https://raw.githubusercontent.com/janLuke/cloup/master/docs/_static/basic-example.png\n :alt: Basic example --help screenshot\n\nIf you don't provide ``--pippo`` or ``--pluto``:\n\n.. code-block:: text\n\n Usage: invoked-command [OPTIONS]\n Try 'invoked-command --help' for help.\n\n Error: at least 1 of the following parameters must be set:\n --pippo\n --pluto\n\nThis simple example just scratches the surface. Read more in the documentation\n(links below).\n\n.. docs-index-end\n\n\nLinks\n=====\n\n* Documentation (release_ | development_)\n* `Changelog <https://cloup.readthedocs.io/en/stable/pages/changelog.html>`_\n* `GitHub repository <https://github.com/janLuke/cloup>`_\n* `Q&A and discussions <https://github.com/janLuke/cloup/discussions>`_\n\n.. _release: https://cloup.readthedocs.io/en/stable/#user-guide\n.. _development: https://cloup.readthedocs.io/en/latest/#user-guide\n",
"bugtrack_url": null,
"license": "BSD 3-Clause",
"summary": "Adds features to Click: option groups, constraints, subcommand sections and help themes.",
"version": "3.0.8",
"project_urls": {
"Homepage": "https://github.com/janLuke/cloup"
},
"split_keywords": [
"cli",
" click",
" argument groups",
" option groups",
" constraints",
" help colors",
" help themes",
" help styles"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "450a494a923f90cd97cdf4fb989cfd06ac0c6745f6dfb8adcef1b7f99d3c7834",
"md5": "27767be3a0650306a88822f02b98657e",
"sha256": "6fe9474dc44fa06f8870e9c797f005de1e3ef891ddc1a9612d9b58598a038323"
},
"downloads": -1,
"filename": "cloup-3.0.8-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "27767be3a0650306a88822f02b98657e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.9",
"size": 54647,
"upload_time": "2025-08-05T02:25:01",
"upload_time_iso_8601": "2025-08-05T02:25:01.536455Z",
"url": "https://files.pythonhosted.org/packages/45/0a/494a923f90cd97cdf4fb989cfd06ac0c6745f6dfb8adcef1b7f99d3c7834/cloup-3.0.8-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "46cf09a31f0f51b5c8ef2343baf37c35a5feb4f6dfdcbd0592a014baf837f2e4",
"md5": "2b096c5623094c88cdc9e18efb931001",
"sha256": "f91c080a725196ddf74feabd6250266f466e97fc16dfe21a762cf6bc6beb3ecb"
},
"downloads": -1,
"filename": "cloup-3.0.8.tar.gz",
"has_sig": false,
"md5_digest": "2b096c5623094c88cdc9e18efb931001",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 229657,
"upload_time": "2025-08-05T02:25:02",
"upload_time_iso_8601": "2025-08-05T02:25:02.830510Z",
"url": "https://files.pythonhosted.org/packages/46/cf/09a31f0f51b5c8ef2343baf37c35a5feb4f6dfdcbd0592a014baf837f2e4/cloup-3.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-05 02:25:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "janLuke",
"github_project": "cloup",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "cloup"
}