Registry / testing / inquirer3

inquirer3

JSON →
library0.6.1pypypi✓ verified 84d ago

Inquirer3 is a Python library providing a collection of common interactive command-line user interfaces, closely mirroring the functionality of Inquirer.js. It is a community-driven fork of the original `python-inquirer` project, aiming for more responsive development and maintenance. The library simplifies the process of asking end-user questions, parsing and validating answers, and managing hierarchical prompts in terminal applications. The current version is 0.6.1, and it maintains an active release cadence with regular updates.

pip install inquirer3
INSTALL
IMPORT
SIG · INQUIRER3
I
inquirer3
testingpythonv0.6.1
Install
2.1s avg
Import
621ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.1 · 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.920 runs
installs and imports cleanly · install 0.0s · import 0.660s · 26.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.1s · import 0.581s · 27MB
23MB installed
● package 23MB
Code
Verified usage

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

Text
from inquirer3 import Text
List
from inquirer3 import List
Checkbox
from inquirer3 import Checkbox
prompt
import inquirer3 answers = inquirer3.prompt(questions)

This quickstart demonstrates how to define a series of interactive questions using `inquirer3.Text` and `inquirer3.List` types, including input validation. The `inquirer3.prompt()` function collects user input and returns answers as a dictionary.

import inquirer3 import re questions = [ inquirer3.Text('name', message="What's your name?"), inquirer3.Text( 'phone', message="What's your phone number?", validate=lambda _, x: re.match(r'\+?\d[\d ]+\d', x) or 'Invalid phone number' ), inquirer3.List( 'size', message='What size do you need?', choices=['Large', 'Medium', 'Small'], default='Medium' ) ] answers = inquirer3.prompt(questions) print(f"Hello {answers['name']}! Your phone is {answers['phone']} and you need a {answers['size']} size.")
Debug
Known issues
breakingIn version 0.6.0, the dependency for the `Editor` question type changed from `python-editor` to `editor`. If you use the `Editor` question, you must install the `editor` package (`pip install editor`) and potentially uninstall `python-editor` to avoid conflicts or errors.
fix
Ensure `pip install editor` is run. If upgrading from <0.6.0 and encountering issues with `Editor` questions, verify `python-editor` is uninstalled and `editor` is installed.
affects: >=0.6.0
gotchaInquirer3's platform support is primarily for UNIX-based systems (macOS, Linux). While Windows has experimental support, users might encounter unexpected behavior or rendering issues. It's recommended to test thoroughly on Windows if targeting that platform.
fix
For Windows users, be aware of potential rendering inconsistencies. Report issues to the GitHub repository to help improve support. Consider using WSL2 for a more consistent UNIX-like environment.
affects: All versions
gotchaThere are multiple Python libraries with 'inquirer' in their name (`python-inquirer`, `PyInquirer`, `inquirerpy`, `inquirer3`). Ensure you are importing from `inquirer3` and installing the `inquirer3` package specifically to avoid compatibility issues or `ModuleNotFoundError` due to different APIs or underlying dependencies.
fix
Always use `pip install inquirer3` and `import inquirer3` (or `from inquirer3 import ...`). Avoid mixing code examples or dependencies from other `inquirer` forks.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'inquirer3'
The `inquirer3` library is not installed in the currently active Python environment, or your IDE/script is configured to use a different Python interpreter where it is not installed.
fix
Activate your virtual environment (if using one) and run `pip install inquirer3`. If using an IDE, ensure it's configured to use the correct Python interpreter where `inquirer3` is installed.
ModuleNotFoundError: No module named 'python_editor' (or similar for 'editor')
The `Editor` question type relies on an external editor library. For `inquirer3 < 0.6.0`, it required `python-editor`. For `inquirer3 >= 0.6.0`, it requires `editor`. This error indicates the necessary dependency is missing.
fix
For `inquirer3 >= 0.6.0`, install `pip install editor`. For `inquirer3 < 0.6.0`, install `pip install python-editor`. Also, ensure your system has a text editor (e.g., `vim`, `nano`) or set the `EDITOR` or `VISUAL` environment variables. [cite: 1, v0.6.0 release notes]
TypeError: prompt() got an unexpected keyword argument 'questions'
This typically occurs when trying to pass a dictionary-based question list (common in `PyInquirer`) to `inquirer3.prompt`, which expects a list of `inquirer3.Question` objects (e.g., `inquirer3.Text`, `inquirer3.List`).
fix
Ensure that `inquirer3.prompt` is called with a list of instantiated `inquirer3.Question` objects, like `[inquirer3.Text('name', message='...'), inquirer3.List('choice', choices=['A', 'B'])]`. Do not use dictionary representations for questions.
Upgrade
Version history
0.6.1latest on PyPI · released Jul 2, 2024
Audit
Dependencies
editoroptionalRequired for using the `inquirer3.Editor` question type, which opens an external text editor for user input. This dependency was introduced in `v0.6.0`, replacing `python-editor`.
Agent activity
8 hits · last 30 days
node
8
Resources
inquirer3 — pip install inquirer3 · libregistry