Skip to main content

the official tsuki-ux for terminal apps

Project description

tsuki-ux · Python

Terminal UX library faithful to the Tsuki project.
Port of cli/internal/ui/ui.go and tools/build.py.

Install

pip install tsuki-ux
# or from source:
pip install -e .

API

Status primitives

from tsuki_ux import success, fail, warn, info, step, note

step("Compilando firmware")       #   ▶  Compilando firmware
success("Hecho")                  #   ✔  Hecho
fail("Algo salió mal")            #   ✖  Algo salió mal  (stderr)
warn("Versión desactualizada")    #   ⚠  Versión desactualizada
info("Usando caché")              #   ●  Usando caché
note("timestamp: 2026-03-21")    #   ●  timestamp: 2026-03-21  (dim)

LiveBlock

from tsuki_ux import LiveBlock

# Context manager
with LiveBlock("cargo build --release") as b:
    b.line("Compiling main.rs...")
    b.line("Linking...")

# Manual
b = LiveBlock("npm install")
b.start()
b.line("added 312 packages")
b.finish(ok=True)
b.finish(ok=False, summary="exit 1")   # expands with all lines

Spinner

from tsuki_ux import Spinner
import time

s = Spinner("Detectando puerto…")
s.start()
time.sleep(1.5)
s.stop(ok=True, msg="Puerto: /dev/ttyUSB0")

Box / Panel

from tsuki_ux import box, config_table, ConfigEntry

box("línea 1\nlínea 2", title="Estado")

config_table("tsuki.json", [
    ConfigEntry("board",     "arduino-nano"),
    ConfigEntry("baud_rate", 115200, comment="velocidad serie"),
    ConfigEntry("verbose",   False),
])

run() — subprocess inside a LiveBlock

from tsuki_ux import run

run(["cargo", "build", "--release"])
run(["npm", "install"], cwd="./frontend", label="npm install")

Rich traceback

from tsuki_ux import traceback_box, Frame, CodeLine

traceback_box(
    err_type="RuntimeError",
    err_msg="buffer overflow",
    frames=[
        Frame(
            file="main.go", line=42, func="read_sensor",
            code=[
                CodeLine(41, "buf := make([]byte, 4)"),
                CodeLine(42, "n, _ = port.Read(buf)", is_pointer=True),
            ],
            locals={"buf": "[0 0 0 0]", "n": "8"},
        )
    ],
)

Adaptive behavior

Environment Output
TTY + color Full animation, ANSI colors, braille spinner, box-drawing
NO_COLOR / TERM=dumb Symbols + structure, no ANSI
Pipe / CI No animation, line-by-line for log capture
Windows (old console) ASCII fallback (+, x, !, -)
Windows Terminal / UTF-8 Full experience

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

tsuki_ux-1.0.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

tsuki_ux-1.0.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file tsuki_ux-1.0.0.tar.gz.

File metadata

  • Download URL: tsuki_ux-1.0.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tsuki_ux-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0c70a9f5bf77d269a771718572f1bca95517aea2a566a5e534405c819d93ad99
MD5 7ce9f819c2afc1a39de76e1e86807cae
BLAKE2b-256 2aad1a5342d3c43589e898c920f273c2b54a902e69d15b3bd3aa1bbb982fd389

See more details on using hashes here.

File details

Details for the file tsuki_ux-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tsuki_ux-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tsuki_ux-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44e7cfb82fd33ed53024b8669c6ead02ee85100bf618dc827ccd87a379ec2144
MD5 cb84a193149d828336f9d32938596779
BLAKE2b-256 090877207944dac5b2137dbeaae4dd334d8c9e8267a9b8884e352082e51522bb

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