Registry / testing / cli-ui

cli-ui

JSON →
library0.19.0pypypi✓ verified 33d ago

cli-ui is a Python library designed to help developers build aesthetically pleasing and user-friendly command-line interfaces. It provides tools for informative messages, error messages, progress indicators, formatting, and interactive user input (e.g., yes/no questions, choices). The current version is 0.19.0, and the project appears to be actively maintained, with recent updates and continued development on its GitHub repository.

testing
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

import cli_ui

This quickstart demonstrates common usage patterns for `cli-ui`, including printing colored messages, showing progress, and gathering user input through yes/no questions and choice selections.

import ui # Informative messages ui.info("This is", ui.green, "green", ui.reset, "text.") ui.info_2("Starting", "Process X...") # Progress indication list_of_items = [f"Item {i}" for i in range(1, 6)] for i, item in enumerate(list_of_items): ui.info_count(i, len(list_of_items), f"Processing {item}") # User input with_confirmation = ui.ask_yes_no("Proceed with action?", default=True) if with_confirmation: fruits = ["apple", "orange", "banana"] selected_fruit = ui.ask_choice("Choose a fruit", choices=fruits) ui.info(f"You selected: {selected_fruit}") else: ui.info("Action cancelled.")
Debug
Known footguns
gotchaWhen redirecting output (e.g., to a file or pipe), `cli-ui`'s colorization might still emit ANSI escape codes. This can lead to unreadable output in non-terminal environments if not handled. The library's `color` configuration can be set to 'never' to prevent this.
gotchaThe `cli-ui` library offers `verbose` and `quiet` configuration options. Misunderstanding their precise behavior can lead to unexpected suppression or display of messages. `quiet` typically hides all but warnings, errors, and fatal messages, while `verbose` enables debug messages.
gotchaThere are other projects with similar names, such as the JavaScript `cliui` (yargs/cliui) and `cli2gui`. Ensure you are referring to the correct Python `cli-ui` library to avoid confusion regarding features, installation, and breaking changes.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources