Registry / web-framework / rich-argparse

rich-argparse

JSON →
library1.8.0pypypi✓ verified 27d ago

rich-argparse provides beautiful, Rich-powered help formatters for Python's argparse and optparse modules. It enhances the standard help output with syntax highlighting, improved layout, and the ability to include Rich renderables like Markdown and tables in descriptions and epilogs. The current version is 1.7.2, and it maintains an active release cadence with regular updates.

pip install rich-argparse
INSTALL
IMPORT
SIG · RICH-ARGPARSE
R
rich-argparse
web-frameworkpythonv1.8.0
Install
2.5s avg
Import
10ms
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 30.3MB
glibc
py 3.103.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()
Debug
Known issues
breakingIn version 2.0, Rich markup will become opt-in instead of opt-out. Existing code relying on automatic markup parsing in descriptions and help messages will need to explicitly enable it.
fix
After upgrading to 2.0.0, consult the documentation for how to explicitly enable Rich markup parsing if your help strings contain Rich syntax.
affects: >=2.0.0
breakingPython 3.8 support will be dropped in version 2.0. The last release to officially support Python 3.8 is 1.7.0. Future versions will require Python 3.9 or newer.
fix
Upgrade your Python environment to 3.9 or newer before upgrading to rich-argparse 2.0.
affects: >=2.0.0
gotchaOn Python 3.14.0a7+ (nightly builds), versions of rich-argparse prior to 1.7.1 could raise a `TypeError` due to changes in `HelpFormatter` arguments, specifically the `console` parameter becoming keyword-only.
fix
Upgrade to rich-argparse version 1.7.1 or newer to resolve `TypeError` issues on Python 3.14+.
affects: <1.7.1
gotchaA regression in versions 1.5.1 and earlier could cause the formatter to crash when handling `%(default)s` style strings, especially if they appeared after markup text.
fix
Ensure you are using rich-argparse version 1.5.2 or later to correctly handle `%(default)s` style without crashes.
affects: <1.5.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'rich_argparse'
The `rich-argparse` library has not been installed in the current Python environment.
fix
pip 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`.
fix
from 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.
fix
pip install rich
TypeError: formatter_class must be a type, not a RichHelpFormatter
`argparse.ArgumentParser` expects `formatter_class` to be the class itself, not an instantiated object.
fix
parser = 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.
Agent activity
7 hits · last 30 days
node
6
Resources
rich-argparse — pip install rich-argparse · libregistry