Skip to main content

Personal-use console utilities library

Project description

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 (12.4.4 or higher)
  • readchar (4.0.0 or higher)
  • requests (2.25.0 or higher)

Python version

Python (3.9 or higher)

Operating System

Any of the following:

  • Windows (10 or higher)
  • Linux (any modern Linux distribution compatible with Python 3.9)
  • 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.
  • 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.

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_datetime(): 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.
  • datetime_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.

Installation

pip install tui_utilities


Update

pip install -U tui_utilities

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tui_utilities-1.9.4.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tui_utilities-1.9.4-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file tui_utilities-1.9.4.tar.gz.

File metadata

  • Download URL: tui_utilities-1.9.4.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for tui_utilities-1.9.4.tar.gz
Algorithm Hash digest
SHA256 9cf3daf800e5b2690d1789adb5088c32837d39aa6fba188bc7468ce0c6ce1862
MD5 ab147c8b3f4bfedbf6193ab8bccd9c12
BLAKE2b-256 23a97090d26bbb63e1a7bfa05afb1a74be485269bbbc28161bd2925df81373e5

See more details on using hashes here.

File details

Details for the file tui_utilities-1.9.4-py3-none-any.whl.

File metadata

  • Download URL: tui_utilities-1.9.4-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for tui_utilities-1.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e6b447341d43edd481fdfa94c4a46af3a9fadb588585ae16e332f357c15f7d8c
MD5 b5f5fd270f194980fdf57d1e72a9685e
BLAKE2b-256 2a6b9621647ad5231c2f28bac7fcbae93cc18aa791144314643c5f66fb7f63df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page