Automatically use rich-argparse help formatters with argparse command line tools.
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
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-argparseIf your tool is installed with uv tool, use the --with flag to install auto-rich-argparse:
uv tool install pre-commit --with auto-rich-argparseYou 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-argparseauto-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 = strThis doesn't currently work if the tool passes a function as the formatter_class argument to
ArgumentParser instead of a class.