Install & Compatibility
Where this runs
tested against v1.8.0 · 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.010s · 30.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.5s · import 0.008s · 31MB
29MB installed
● package 29MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
RichHelpFormatter
✓ from rich_argparse import RichHelpFormatter
This quickstart demonstrates how to apply `RichHelpFormatter` to an `argparse.ArgumentParser` instance. It showcases rich markup directly within the description and help messages, which `RichHelpFormatter` will render beautifully in the terminal when `parser.print_help()` is called or `--help` is invoked.
import argparse
from rich_argparse import RichHelpFormatter
parser = argparse.ArgumentParser(
description='A command-line tool with \n[bold blue]rich[/bold blue] help formatting.',
formatter_class=RichHelpFormatter
)
parser.add_argument('--name', '-n', help='Your name.')
parser.add_argument('--age', '-a', type=int, help='Your age.')
parser.add_argument(
'--verbose', '-v', action='store_true',
help='[dim]Enable verbose output.[/dim]'
)
# To display the rich help, you would typically run your script with --help
# or allow argparse to display it on invalid input.
# For demonstration, we can try parsing arguments that trigger help:
# try:
# parser.parse_args(['--help'])
# except SystemExit: # argparse raises SystemExit on --help
# pass
# To simply see the formatted output in a script context:
# This will print the help to the console
parser.print_help()
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'rich_argparse'
The `rich-argparse` library has not been installed in the current Python environment.
fixpip install rich-argparse
AttributeError: module 'rich_argparse' has no attribute 'RichArgumentParser'
The user is attempting to import a non-existent class `RichArgumentParser` instead of the correct `RichHelpFormatter`.
fixfrom rich_argparse import RichHelpFormatter
ModuleNotFoundError: No module named 'rich'
The `rich` library, which `rich-argparse` depends on, is missing or inaccessible in the current Python environment.
TypeError: formatter_class must be a type, not a RichHelpFormatter
`argparse.ArgumentParser` expects `formatter_class` to be the class itself, not an instantiated object.
fixparser = argparse.ArgumentParser(formatter_class=RichHelpFormatter)
Upgrade
Version history
1.8.0latest on PyPI · released May 1, 2026
Audit
Dependencies
richrequiredProvides the core rendering capabilities for the enhanced help output.