Skip to main content

auto-rich-argparse

Automatically use rich-argparse help formatters with argparse command line tools.

Usage

Install auto-rich-argparse in the same environment as your command line tool.

Try it out with your favorite tool using uvx --with auto-rich-argparse <YOUR_FAVORITE_TOOL> --help

Tools installed with pipx

If your tool is installed with pipx, use the pipx inject command to add auto-rich-argparse to the tool's environment. For example, to use rich-argparse with pre-commit:

pipx inject pre-commit auto-rich-argparse

Tools installed with uv tool

If your tool is installed with uv tool, use the --with flag to install auto-rich-argparse:

uv tool install pre-commit --with auto-rich-argparse

Tools in the current project

You can also install auto-rich-argparse in you project's environment and it will be used by all tools that use argparse in that environment:

python -m pip install auto-rich-argparse

How it works

auto-rich-argparse works by monkey patching the argparse.ArgumentParser class to use a subclass of RichHelpFormatter from rich-argparse instead of the default argparse.HelpFormatter. The formatter tries to be compatible with the tool's formatter by setting the following options:

FormatterClass.help_markup = False
FormatterClass.text_markup = False
FormatterClass.group_name_formatter = str

Known limitations

This doesn't currently work if the tool passes a function as the formatter_class argument to ArgumentParser instead of a class.

Metadata

Release files for auto-rich-argparse 0.1.0

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

Source distribution (sdist)

Source distribution for auto-rich-argparse 0.1.0
File Size Uploaded
auto_rich_argparse-0.1.0.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for auto-rich-argparse 0.1.0
File Interpreter ABI Platform
auto_rich_argparse-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / auto_rich_argparse-0.1.0.tar.gz

Download URL auto_rich_argparse-0.1.0.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
59b22a13f4a6f1d203078def3fe84fef04ae593ac5e577cc6edcdb2508fcb162
BLAKE2b-256 checksum
How to use checksums
aab546540972601586d6eda8fef61af789497f5d5a55936078c9d2e1810cb1cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / auto_rich_argparse-0.1.0-py3-none-any.whl

Download URL auto_rich_argparse-0.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b3ba3555078d6f762bfe1fc3a0648f95b3da7dea2727f81404b2085ff489d75
BLAKE2b-256 checksum
How to use checksums
31021577e15742fee2e54c2c2b8859f5806238b105fe07c152f10361b8500f6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

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