{"id":2072,"library":"inquirer","title":"Python Inquirer","description":"Inquirer is a Python library that provides a collection of common interactive command-line user interfaces, based on the popular Inquirer.js. It aims to simplify asking questions, parsing and validating answers, and managing hierarchical prompts in CLI applications. The library is actively maintained and receives regular updates, with the current version being 3.4.1.","status":"active","version":"3.4.1","language":"en","source_language":"en","source_url":"https://github.com/magmax/python-inquirer","tags":["cli","interactive","prompt","user interface"],"install":[{"cmd":"pip install inquirer","lang":"bash"}],"dependencies":[{"reason":"Requires Python 3.9.2 or higher.","package":"python","optional":false},{"reason":"Improved Unicode support on Windows, especially from v3.4.0 onwards.","package":"readchar","optional":false}],"imports":[{"note":"The main entry point for creating and prompting questions.","symbol":"inquirer","correct":"import inquirer"},{"note":"The function used to display prompts and collect answers.","symbol":"inquirer.prompt","correct":"import inquirer\nanswers = inquirer.prompt(questions)"},{"note":"This registry entry refers to the `inquirer` library (magmax/python-inquirer). While inspired by Inquirer.js, `PyInquirer` was a different, less maintained project, and `InquirerPy` is another re-implementation. Ensure you are importing from `inquirer`.","wrong":"from PyInquirer import prompt","symbol":"Question Types","correct":"import inquirer\ninquirer.Text(...)\ninquirer.List(...)\ninquirer.Confirm(...)\ninquirer.Checkbox(...)\ninquirer.Editor(...)\ninquirer.Path(...)\ninquirer.Password(...)"}],"quickstart":{"code":"import inquirer\n\nquestions = [\n    inquirer.Text('name', message=\"What's your name?\"),\n    inquirer.List(\n        'size',\n        message=\"What size do you need?\",\n        choices=['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro'],\n    ),\n    inquirer.Confirm('confirm', message=\"Proceed?\")\n]\n\nanswers = inquirer.prompt(questions)\nprint(f\"Hello, {answers['name']}! You selected {answers['size']} and confirmed: {answers['confirm']}\")","lang":"python","description":"This quickstart demonstrates how to create a list of different question types (Text, List, Confirm) and use `inquirer.prompt` to display them to the user, collecting the answers in a dictionary."},"warnings":[{"fix":"Upgrade Python to 3.9.2 or newer, or downgrade `inquirer` to 3.4.0 or earlier.","message":"Python 3.8 is no longer supported. Users on Python 3.8 will need to upgrade their Python version to 3.9.2 or higher, or stick to an older `inquirer` version (<=3.4.0).","severity":"breaking","affected_versions":">=3.4.1"},{"fix":"Review code using `inquirer.Path` and remove the `normalize_to_absolute_path` argument. Adjust path handling logic if absolute paths were previously relied upon through this argument.","message":"The `normalize_to_absolute_path` argument has been removed from the `inquirer.Path` question type.","severity":"breaking","affected_versions":">=3.3.0"},{"fix":"Ensure your validation lambda or function has the signature `def validate_func(answers, current):` even if `answers` is not used. Return `True` for success, or raise `inquirer.errors.ValidationError('', reason='Your custom message')` for a custom error.","message":"Validation functions for questions must accept two arguments: `(answers, current)`, where `answers` is a dictionary of previously collected responses and `current` is the input for the current question. Providing only one argument (e.g., `lambda current: ...`) will cause validation to always fail, as exceptions are caught and treated as validation errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your virtual environment is activated before running `pip install inquirer`. Verify that the Python interpreter being used is the one from the virtual environment.","message":"Users often encounter `ModuleNotFoundError` when installing `inquirer` in a virtual environment. This is typically due to the virtual environment not being correctly activated or `pip install` being run outside the activated environment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use descriptive variable names for question IDs that do not conflict with Python's built-in keywords or types. For example, instead of `list = [...]`, use `my_list_of_questions = [...]`.","message":"Avoid using Python's built-in keywords or common types as variable names for your question IDs (e.g., `list`, `dict`). This can shadow the built-in type and lead to unexpected behavior or difficult-to-debug errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Report any Windows-specific issues encountered on the GitHub repository. Consider testing your CLI application on a UNIX-like environment if consistent behavior is critical across platforms.","message":"While Windows support has seen improvements (e.g., Unicode handling in v3.4.0), it is still considered experimental. Users may encounter platform-specific issues compared to UNIX-based systems.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}