🌐
GitHub
github.com › your-tools › python-cli-ui
GitHub - your-tools/python-cli-ui: Tools for better command line interfaces · GitHub
import cli_ui # coloring: cli_ui.info( "This is", cli_ui.red, "red", cli_ui.reset, "and this is", cli_ui.bold, "bold" ) # enumerating: list_of_things = ["foo", "bar", "baz"] for i, thing in enumerate(list_of_things): cli_ui.info_count(i, len(list_of_things), thing) # progress indication: cli_ui.info_progress("Done", 5, 20) cli_ui.info_progress("Done", 10, 20) cli_ui.info_progress("Done", 20, 20) # reading user input: with_sugar = cli_ui.ask_yes_no("With sugar?", default=False) fruits = ["apple", "orange", "banana"] selected_fruit = cli_ui.ask_choice("Choose a fruit", choices=fruits) # ...
🌐
Your-tools
your-tools.github.io › python-cli-ui
Python CLI UI — cli_ui 0.1.0 documentation
cli-ui is available on Pypi. and is compatible with Python 3.9 and higher.
🌐
Medium
k3no.medium.com › command-line-uis-in-python-80af755aa27d
Command Line UI’s in Python. A practical overview for you and me. | by Keno Leon | Medium
July 17, 2021 - So here we will check out the alternative, humble command line user interfaces in python, come along if like me you are new to the subject and want to see what goes into making them. ⚠️ Note: This is a beginner friendly overview rather than an in- depth tutorial, so after reading this you should have a good idea of what your options are for Command Line Interfaces (CLI) along with some basic code samples which should inform you what to learn next. The most basic UI I can think of would consist of a prompt on your command line asking (prompting) for a simple Yes/No or similar answer and then the script does something depending on your answer, if you think about it, the vast majority of UIs graphic or otherwise use this pattern:
🌐
PyPI
pypi.org › project › cli-ui
cli-ui · PyPI
import cli_ui # coloring: cli_ui.info( "This is", cli_ui.red, "red", cli_ui.reset, "and this is", cli_ui.bold, "bold" ) # enumerating: list_of_things = ["foo", "bar", "baz"] for i, thing in enumerate(list_of_things): cli_ui.info_count(i, len(list_of_things), thing) # progress indication: cli_ui.info_progress("Done", 5, 20) cli_ui.info_progress("Done", 10, 20) cli_ui.info_progress("Done", 20, 20) # reading user input: with_sugar = cli_ui.ask_yes_no("With sugar?", default=False) fruits = ["apple", "orange", "banana"] selected_fruit = cli_ui.ask_choice("Choose a fruit", choices=fruits) # ...
🌐
PyPI
pypi.org › project › python-cli-ui
python-cli-ui · PyPI
Download URL: python_cli_ui-0.7.5-py3-none-any.whl
      » pip install python-cli-ui
    
Published: Feb 20, 2019
Version: 0.7.5
🌐
Dimitri Merejkowsky
dmerej.info › blog › post › introducing-python-cli-ui
Introducing python-cli-ui • Dimitri Merejkowsky - dmerej.info
def say_hello(name): ui.info("Hello", name) def test_say_hello(messages): say_hello("John") assert messages.find(r"Hello\w+John") Well, I hope you’ll find this module useful. It is available as python-cli-ui on pypi · Cheers! Thanks for reading this far :) I'd love to hear what you have to say, so please feel free to leave a comment below, or read the contact page for more ways to get in touch with me.
🌐
Qodo
qodo.ai › blog › code integrity › building user-friendly python command-line interfaces with click
Building User-Friendly Python CLI with Click - Qodo
February 17, 2025 - Unlike graphical user interfaces (GUIs) that rely on visual elements and mouse-driven interactions, a CLI relies on plain text commands entered via a terminal or command prompt. These commands trigger actions, retrieve information, and configure ...
Top answer
1 of 5
68

After a bit of searching, I found two libraries that met my needs!

The first is python-inquirer, a Python port of Inquirer.js, a CLI library used by projects like Yeoman. I found this library to have a really nice API (built on top of blessings) but lacks polish when it comes to design/features.

The second (which I will be using) is whaaaaat, another Python port of Inquirer. This library offers functionality much closer to the original Inquirer.js and is exactly what I needed. The API is less clean than that of python-inquirer, however.

Examples:

python-inquirer example:

from pprint import pprint
import inquirer

questions = [
    inquirer.List(
        "size",
        message="What size do you need?",
        choices=["Jumbo", "Large", "Standard", "Medium", "Small", "Micro"],
    ),
]

answers = inquirer.prompt(questions)
pprint(answers)

whaaaaat example:

from whaaaaat import prompt, print_json, Separator

questions = [
    {
        "type": "list",
        "name": "theme",
        "message": "What do you want to do?",
        "choices": [
            "Order a pizza",
            "Make a reservation",
            Separator(),
            "Ask for opening hours",
            {"name": "Contact support", "disabled": "Unavailable at this time"},
            "Talk to the receptionist",
        ],
    },
    {
        "type": "list",
        "name": "size",
        "message": "What size do you need?",
        "choices": ["Jumbo", "Large", "Standard", "Medium", "Small", "Micro"],
        "filter": lambda val: val.lower(),
    },
]

answers = prompt(questions)
print_json(answers)
2 of 5
20

Few more alternatives for command-line form input libraries:

  • tmbo/questionary
  • Exahilosys/survey
  • kamik423/cutie
  • petereon/beaupy

Note: I am the maintainer of beaupy

Find elsewhere
🌐
PyPI
pypi.python.org › pypi › python-cli-ui › 0.5.0
We cannot provide a description for this page right now
🌐
Python
docs.python.org › 3 › library › cmdlinelibs.html
Command-line interface libraries — Python 3.15.0 documentation
The modules described in this chapter assist with implementing command line and terminal interfaces for applications. Here’s an overview: argparse — Parser for command-line options, arguments and s...
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › scenarios › cli
Command-line Applications — The Hitchhiker's Guide to Python
Python Fire is a library for automatically generating command-line interfaces from absolutely any Python object. It can help debug Python code more easily from the command line, create CLI interfaces to existing code, allow you to interactively explore code in a REPL, and simplify transitioning between Python and Bash (or any other shell).
🌐
PyPI
pypi.org › project › cli2gui
cli2gui · PyPI
Cli2Gui enables you to convert command-line interface (CLI) applications into graphical user interfaces (GUIs) with minimal effort. Designed to accommodate a wide variety of use cases, this library allows developers to maintain a CLI while ...
🌐
Real Python
realpython.com › ref › glossary › command-line-interface
command-line interface (CLI) | Python Glossary – Real Python
Unlike a graphical user interface (GUI), which relies on visual elements like windows, buttons, and menus, a CLI accepts text input and returns text output. Users type exact commands, so they control precisely what a program does.
🌐
Gentoo
packages.gentoo.org › packages › dev-python › cli-ui
dev-python/cli-ui – Gentoo Packages
Python library for better command line interfaces · https://your-tools.github.io/python-cli-ui/
🌐
Medium
medium.com › @noransaber685 › simple-guide-to-creating-a-command-line-interface-cli-in-python-c2de7b8f5e05
Simple Guide to Creating a Command-Line Interface (CLI) in Python | by Noran Saber Abdelfattah | Medium
February 3, 2024 - Type "help" for available commands.' def __init__(self): super().__init__() self.current_directory = os.getcwd() def do_list(self, line): """List files and directories in the current directory.""" files_and_dirs = os.listdir(self.current_directory) for item in files_and_dirs: print(item) def do_change_dir(self, directory): """Change the current directory.""" new_dir = os.path.join(self.current_directory, directory) if os.path.exists(new_dir) and os.path.isdir(new_dir): self.current_directory = new_dir print(f"Current directory changed to {self.current_directory}") else: print(f"Directory '{dir
🌐
DEV Community
dev.to › usooldatascience › mastering-command-line-interfaces-cli-in-python-a-comprehensive-guide-10bc
Mastering Command-Line Interfaces (CLI) in Python: A Comprehensive Guide - DEV Community
September 15, 2024 - Test with edge cases: Ensure your CLI tool behaves correctly even with invalid inputs. Modularize your code: Keep your command-line logic separate from your core functionality for easier testing and maintenance. Python provides an excellent toolkit for building Command-Line Interface (CLI) applications.
🌐
Click Documentation
click.palletsprojects.com
Welcome to Click — Click Documentation (8.5.x)
Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary.