Registry / devops / click-help-colors

click-help-colors

JSON →
library0.9.4pypypi✓ verified 25d ago

click-help-colors is a Python library that provides colorization for help messages in Click, a popular library for creating command-line interfaces. It allows users to customize the colors of headers, options, and custom elements within their CLI's help output, enhancing readability and user experience. The current version is 0.9.4. Its release cadence is irregular, with updates typically driven by compatibility requirements with new Click versions or feature enhancements.

pip install click-help-colors
INSTALL
IMPORT
SIG · CLICK-HELP-COLORS
C
click-help-colors
devopspythonv0.9.4
Install
1.6s avg
Import
70ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.4 · 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.074s · 18.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.066s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HelpColorsGroup
from click_help_colors import HelpColorsGroup
HelpColorsCommand
from click_help_colors import HelpColorsCommand

This quickstart demonstrates how to apply colored help messages to both a Click group and a subcommand using `HelpColorsGroup` and `HelpColorsCommand`. It sets global header and option colors for the group, and then overrides or adds custom option colors for `command1`.

import click from click_help_colors import HelpColorsGroup, HelpColorsCommand @click.group( cls=HelpColorsGroup, help_headers_color='yellow', help_options_color='green', help_options_custom_colors={'command2': 'red'} ) def cli(): """A command line interface with colored help. This is a demonstration of click-help-colors. """ pass @cli.command( cls=HelpColorsCommand, help_headers_color=None, help_options_color=None, help_options_custom_colors={'--count': 'cyan'} ) @click.option('--count', default=1, help='Number of greetings.') @click.option('--name', default='World', help='The person to greet.') def command1(count, name): """Greets the given NAME for a total of COUNT times.""" for x in range(count): click.echo(f"Hello {name}!") @cli.command() def command2(): """Another command with default colors.""" click.echo('This is command 2') if __name__ == '__main__': cli()
Debug
Known issues
breakingOlder versions of `click-help-colors` were incompatible with Click 8.0. Ensure you are using `click-help-colors` version 0.9.0 or newer for full compatibility with Click 8.x and above.
fix
Upgrade `click-help-colors` to 0.9.0 or higher: `pip install --upgrade click-help-colors`.
affects: <0.9.0
gotchaClick 8.0 dropped support for Python 2 and Python 3.5. If you are using `click-help-colors` with Click 8.0+, your project must be running on Python 3.6 or newer.
fix
Ensure your project uses Python 3.6 or a more recent version.
affects: Click >= 8.0
gotchaCustom help option colors (`help_options_custom_colors`) need to be specified carefully. Keys in this dictionary should exactly match the option string (e.g., '--my-option' or '-m') for the color to apply correctly.
fix
Double-check that the keys in `help_options_custom_colors` precisely match the option strings defined in your Click commands.
affects: All
Errors
Common errors & fixes
ImportError: cannot import name 'iteritems' from 'click._compat'
This error occurs due to an incompatibility between older versions of `click-help-colors` (e.g., 0.8) and newer versions of the `Click` library (e.g., Click 8.0+), as the `_compat.iteritems` utility was removed or changed in Click.
fix
Upgrade `click-help-colors` to its latest version to ensure compatibility with your installed `Click` version: `pip install --upgrade click-help-colors`
ModuleNotFoundError: No module named 'click_help_colors'
The `click-help-colors` library is not installed in the Python environment where the code is being executed, or the environment is not correctly configured to find installed packages.
fix
Install the library using pip: `pip install click-help-colors`
Click help colors not showing / No color output in terminal
Colors may not appear if the output stream is not detected as a TTY (e.g., when piping output or running in certain IDEs/CI environments), if the terminal does not support ANSI escape codes, or if environment variables like `NO_COLOR` are set.
fix
Ensure you are running in a TTY-enabled terminal. If running in a script or CI, you might need to explicitly enable colors using `FORCE_COLOR=1` environment variable, or configure `click-help-colors` if it provides an option to force colors regardless of TTY detection.
Upgrade
Version history
0.9.4latest on PyPI · released Nov 18, 2023
Audit
Dependencies
clickrequiredCore dependency; click-help-colors extends Click's functionality for help message formatting.
Agent activity
14 hits · last 30 days
node
10
OpenAI (training)
1
Resources
click-help-colors — pip install click-help-colors · libregistry