beaupy

raw JSON →
3.11.0 verified Fri May 01 auth: no python

A library for building interactive terminal user interfaces (TUIs) in Python. Current version 3.11.0, supports Python 3.7.8 to <4.0.0. Released under MIT license. Active development with frequent releases.

pip install beaupy
error ImportError: cannot import name 'prompt_int' from 'beaupy'
cause prompt_int was removed in beaupy 3.8.0+.
fix
Use beaupy.prompt('Enter number:', validator=int) instead.
error TypeError: 'str' object is not callable
cause Incorrect usage: `beaupy.select` expects a list, not a string.
fix
Ensure you pass a list of options: beaupy.select(['a', 'b', 'c']).
gotcha Some functions like `select` and `select_multiple` do not work correctly in certain terminals if the terminal is not in raw mode. Ensure your terminal supports raw input.
fix Use `beaupy.keys` for key handling or set environment variable `BEAUPY_RAWMODE=0` to disable raw mode.
deprecated The `beaupy.prompt_int` and `beaupy.prompt_float` functions are deprecated in favor of `beaupy.prompt` with type validation.
fix Use `beaupy.prompt(..., validator=int)` or `beaupy.prompt(..., validator=float)` instead.
breaking In version 3.0.0, the internal refactoring moved several functions. `beaupy.select` now returns the selected item directly instead of a tuple.
fix Update code: `result = beaupy.select(options)` instead of `(result, index) = beaupy.select(options)`.

Ask for user input and confirmation using beaupy.

import beaupy

name = beaupy.prompt("What is your name?")
print(f"Hello, {name}!")

if beaupy.confirm("Continue?"):
    print("Continuing...")