InquirerPy

0.3.4 · active · verified Thu Apr 09

InquirerPy is a Python port of the famous Inquirer.js, offering a collection of common interactive command-line user interfaces. It is a re-implementation of the PyInquirer project, focusing on bug fixes, new prompts, backward-compatible APIs, and enhanced customization. Currently at version 0.3.4, the library maintains an active development and release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the recommended 'Alternate Syntax' to create and execute common interactive prompts like text input, single-choice selection, and confirmation. The `.execute()` method runs the prompt and returns the user's input.

from InquirerPy import inquirer

name = inquirer.text(message="What's your name:").execute()
fav_lang = inquirer.select(
    message="What's your favourite programming language:",
    choices=["Go", "Python", "Rust", "JavaScript"],
).execute()
confirm = inquirer.confirm(message="Confirm?").execute()

print(f"Hello {name}, your favourite language is {fav_lang}, and you confirmed: {confirm}")

view raw JSON →