Skip to main content

Tiny terminal UI utility for clean, colorful build output.

Project description

tuiro

tuiro is a tiny terminal UI helper designed for clean, readable, and structured output in build scripts and command‑line tools. It provides simple utilities for sections, banners, status messages, command logging, and themed output without introducing heavy dependencies or complex abstractions.

tuiro began as an internal utility inside the TactileBrowser project (https://github.com/NellowTCS/TactileBrowser). It is now available as a standalone library for any script or tool that wants clear and consistent terminal output.

Features

  • Lightweight and dependency‑free
  • ANSI color support with optional CI mode
  • Built‑in themes and user‑defined palettes
  • Section and subsection headers
  • Informational, warning, success, and error messages
  • Command logging for build steps
  • Centered banners with automatic terminal width detection
  • A simple step context manager for build phases
  • A minimal CLI for quick verification and theme testing

Installation

pip install tuiro

For development:

uv pip install -e .

Usage

Basic example:

from tuiro import TUI

tui = TUI()
tui.banner("Build")
tui.section("Environment")
tui.info("Checking dependencies")
tui.success("All checks passed")

Example output (colors omitted):

╔══════════════════════════════════════════════════════════╗
║                          Build                           ║
╚══════════════════════════════════════════════════════════╝

────────────────────────────────────────────────────────────
  Environment
────────────────────────────────────────────────────────────
[*] Checking dependencies
[OK] All checks passed

Themes

tuiro supports both built‑in themes and user‑defined palettes.

Built‑in themes

  • default
  • mono
  • pastel

Use a theme by name:

tui = TUI(theme="pastel")

Custom palettes

Palettes live in tuiro.palette. Users can define their own palette by subclassing Palette:

from tuiro.palette import Palette
from tuiro.colors import Colors

class MyPalette(Palette):
    success = Colors.BRIGHT_GREEN
    info = Colors.BRIGHT_CYAN

Then pass it to TUI:

tui = TUI(theme=MyPalette)

or:

tui = TUI(theme=MyPalette())

Note: The CLI --theme flag accepts only built‑in theme names from PROFILES. Custom palettes must be provided from Python code.

CLI

tuiro includes a small demonstration CLI:

tuiro

Flags:

tuiro --ci
tuiro --no-color
tuiro --theme pastel
tuiro --help
tuiro --version

Behavior:

  • --ci disables colors
  • --no-color also disables colors
  • If both are provided, colors remain disabled
  • --theme NAME selects a built‑in theme
  • --help lists available themes

Example:

tuiro --ci --theme mono

API

TUI(ci_mode: bool = False, theme: str | Palette = "default")

Creates a new terminal UI helper.

section(title: str)

Prints a high‑visibility section header.

subsection(title: str)

Prints a smaller subsection header.

banner(title: str)

Prints a centered banner.

Status messages

info(message: str)
success(message: str)
warning(message: str)
error(message: str)

command(cmd: str | list[str])

Prints a command being executed. Lists are joined with spaces.

result(label: str, value: str)

Prints a key‑value result line.

table(rows: list[tuple[str, str]])

Prints a simple two‑column table aligned on the left column.

step(title: str)

Context manager for build steps:

with tui.step("Compiling"):
    run_compiler()

License

MIT License. See (LICENSE)[LICENSE] for details.

Project details


Download files

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

Source Distribution

tuiro-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

tuiro-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file tuiro-0.1.0.tar.gz.

File metadata

  • Download URL: tuiro-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tuiro-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74bd33159f2bb897fd4276a0b8ab3f9bc287c8c4fd49d32de1121c14ceca7889
MD5 27a6cfcd566f85051239f66a9c160a5a
BLAKE2b-256 9863c7b451e1dc160117ddab2251e068536430cf340268a11c5fc191057b7342

See more details on using hashes here.

File details

Details for the file tuiro-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tuiro-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tuiro-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87c5f6f631f4fe825ed4735ac8618b89bbc0c91ad6534f50a93168341266b5ef
MD5 4817532bdeb34735d2f070f3ec390d60
BLAKE2b-256 b75088b0ec3c896cc8d4fe7eb30741a925ff7090b16e4aa78f6e82c134e1e700

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