Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rich-click logo

Richly rendered command line interfaces in click.

PyPI Test Coverage badge Lint code badge


Documentation  ·  Source Code  ·  Changelog


rich-click is a shim around Click that renders help output nicely using Rich.

  • Click is a "Python package for creating beautiful command line interfaces".
  • Rich is a "Python library for rich text and beautiful formatting in the terminal".

The intention of rich-click is to provide attractive help output from Click, formatted with Rich, with minimal customisation required.

Features

  • 🌈 Rich command-line formatting of click help and error messages
  • 💫 Nice styles be default, usage is simply import rich_click as click
  • 💻 CLI tool to run on other people's tools (prefix the command with rich-click)
  • 📦 Export help text as HTML or SVG
  • 🎁 Group commands and options into named panels
  • ❌ Well formatted error messages
  • 🔢 Easily give custom sort order for options and commands
  • 🎨 Extensive customisation of styling and behaviour possible

Installation

pip install rich-click

Read the docs for all supported installation methods.

Examples

Simple Example

To use rich-click in your code, replace import click with import rich_click as click in your existing click CLI:

import rich_click as click

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

if __name__ == '__main__':
    hello()

python examples/11_hello.py --help

Screenshot from examples/11_hello.py

More complex example

examples/03_groups_sorting.py

Screenshot from examples/03_groups_sorting.py

Usage

This is a quick overview of how to use rich-click. Read the docs for more information.

There are a couple of ways to begin using rich-click:

Import rich_click as click

Switch out your normal click import with rich_click, using the same namespace:

import rich_click as click

That's it! ✨ Then continue to use Click as you would normally.

See examples/01_simple.py for an example.

Declarative

If you prefer, you can RichGroup or RichCommand with the cls argument in your click usage instead. This means that you can continue to use the unmodified click package in parallel.

See examples/02_declarative.py for an example.

rich-click CLI tool

rich-click comes with a CLI tool that allows you to format the Click help output from any package that uses Click.

To use, prefix rich-click to your normal command. For example, to get richified Click help text from a package called awesometool, you could run:

$ rich-click awesometool --help

Usage: awesometool [OPTIONS]
..more richified output below..

License

This project is licensed under the MIT license.

Metadata

Release files for rich-click 1.8.0.dev2

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

Source distribution (sdist)

Source distribution for rich-click 1.8.0.dev2
File Size Uploaded
rich-click-1.8.0.dev2.tar.gz 36.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rich-click 1.8.0.dev2
File Interpreter ABI Platform
rich_click-1.8.0.dev2-py3-none-any.whl Python 3 none any Details

Total release size: 70.1 kB

Release files / rich-click-1.8.0.dev2.tar.gz

Download URL rich-click-1.8.0.dev2.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a48c32d2edc0c21a23e8282fb5719b454cf50ddc77abb01707f1ae65259abb1a
BLAKE2b-256 checksum
How to use checksums
ad703b44d4d5cd3361fe2566cbc064e4309f4fa618677e6215e2e5642dd1e24a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / rich_click-1.8.0.dev2-py3-none-any.whl

Download URL rich_click-1.8.0.dev2-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31a30f43f63a793ba1983aa3038e514afdd80141508c7102cdaa55648f148b9e
BLAKE2b-256 checksum
How to use checksums
2d5e3ea9adb1308c48ba0c1ad758703e9f109f8ff5e0f225f5365d01821f9534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

1.9.9

2 release files

1.9.8

2 release files

1.9.7

2 release files

1.9.6

2 release files

1.9.5

2 release files

1.9.4

2 release files

1.9.3

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.9

2 release files

1.8.8

2 release files

1.8.7

2 release files

1.8.6

2 release files

1.8.5

2 release files

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

This release

1.8.0.dev2 This release

2 release files

1.7.4

2 release files

1.7.3

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5

2 release files

1.4

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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