TUI Utilities
Personal-use console utilities library providing styled terminal interaction, structured menus, robust input validation, formatting helpers, and Spanish-oriented user experience.
Purpose
This library is designed for console-based applications that need:
- Clean TUI
- Structured Spanish-language user interaction
- Robust validation
- Consistent formatting
Requirements
Dependencies
Standard library modules are used where possible; only external dependencies are listed:
- rich (9.13.0 or higher)
- readchar (3.0.5 or higher)
- requests (2.25.0 or higher)
Python version
Python (3.9 or higher)
Operating System
Any of the following:
- Windows (8.1 or higher)
- Linux (any modern distribution capable of running Python 3.9 in an interactive terminal environment)
- MacOS (10.9 or higher)
Google Colaboratory support
This library is fully compatible with Google Colaboratory.
Features
Console Utilities (console)
Styled terminal interaction built on rich:
- print(): styled print function built on rich, supporting text styles, alignment, padding, and per-segment styling.
- grouped_output(): groups multiple
print()calls into one output block, preserving Rich's HTML output in Jupyter. - input(): styled input function built on rich, supporting text styles and automatically trimming whitespaces.
- clear_console(): clears the terminal screen.
- wait_for_key(): pauses execution until the user presses a key.
Use grouped_output() when several outputs should appear together in a Jupyter notebook:
import tui_utilities as tui
with tui.grouped_output():
tui.print("First line")
tui.print("Second line")
Keep interactive input() calls outside the grouped block so their prompts are displayed before input is requested.
Structure Utilities (structure)
Tools for building structures in console applications:
- header(): prints a styled header, consisting of a title and a separator.
- menu(): creates interactive selection menus with header and automatic selection validation.
- confirmation_menu(): creates a confirmation dialog with custom message and options.
- confirm_exit(): creates a confirmation dialog that exits the program safely (uses confirmation_menu()).
- table(): creates personalized tables with easy introduction of fully-styled columns and rows.
- separator(): prints a fully-personalized visual separator line.
- error_message(): displays formatted error information including:
- Custom message
- Exception details
- Full traceback
Input Validation (validation)
Interactive validation utilities for user input:
- check_if_list_is_empty(): checks if a list is empty and displays an error screen if it is.
- validate_option(): validates user selection from a dictionary of options.
- validate_string(): ensures non-empty string input.
- validate_integer(): validates integers (uses Continental European numeric format) with optional range validation through an advanced syntax (syntax example: "(-infinity; 0] | 5 | [10; infinity)").
- validate_double(): validates decimal numbers (uses Continental European numeric format) with support for fractions and mathematical constants ("pi", "e", "tau", "phi") and optional range validation through an advanced syntax (syntax example: "(-infinity; 0,1] | 1/3 | [pi; infinity)").
- validate_date_time(): validates date and time input (uses Day–Month–Year date format with 24-hour time) with selectable year, time and second inclusion.
- validate_id(): validates Argentinian national ID numbers.
- validate_cellphone_number(): validates cellphone numbers (uses Argentinian format).
- validate_email(): validates e-mail addresses using an official TLDs list (from IANA's website) or syntax fallback (in case of not having an internet connection or a locally imported list of TLDs).
Formatting Helpers (format)
Utilities for applying consistent formatting:
- decimal_format(): applies Continental European numeric formatting and optional monetary value formatting.
- date_time_format(): formats datetime objects (uses Day–Month–Year date format with 24-hour time) with automatic or custom year, time and second inclusion.
- id_format(): formats Argentinian national ID numbers.
- cellphone_number_format(): formats cellphone numbers (uses Argentinian format).
System Utilities (system)
Helpers for interacting with the operating system console environment:
- set_window_title(): sets the console window title.
- maximize_window(): maximizes the console window.
- set_locale(): configures the process locale for number, date, and cultural formatting.
- get_resources_path(): returns the absolute path to the resources directory, regardless of whether the program is running as a script in an IDE or as an executable.
- in_google_colaboratory(): returns True if the program is running in Google Colaboratory, False otherwise.
Installation
pip install tui_utilities
Update
pip install -U tui_utilities
Metadata
Release files for tui-utilities 1.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tui_utilities-1.10.0.tar.gz | 21.1 kB | Without provenance | Details for tui_utilities-1.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tui_utilities-1.10.0-py3-none-any.whl | Python 3 | none | any | Details for tui_utilities-1.10.0-py3-none-any.whl |
Total release size: 40.8 kB
Release files / tui_utilities-1.10.0.tar.gz
| Download URL | tui_utilities-1.10.0.tar.gz |
|---|---|
| Size | 21.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
767f614ae6c8c3678a0832a0c3d831450aa98afa35ce9ea024843d120cf149db
|
|
BLAKE2b-256 checksum How to use checksums |
a8fa01b25b85fc7012acac94e55d88116be6c5daa7783485ad27dbbf79c0f0ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / tui_utilities-1.10.0-py3-none-any.whl
| Download URL | tui_utilities-1.10.0-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a158ce7eda3eec901c196154f6fbda8a3571aa903d6a54029849335809ca70b1
|
|
BLAKE2b-256 checksum How to use checksums |
61889009b4c87353cfa221cd0f15c69492f5e413710b30a0e8681cc670a52618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for tui-utilities 1.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.