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.10.tar.gz (18.2 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.10-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tsuki_ux-1.0.10.tar.gz
  • Upload date:
  • Size: 18.2 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.10.tar.gz
Algorithm Hash digest
SHA256 066626a7be120c6716f38ccb4fef60a68a0856e0afa3b2ce824d41fe4f3f6e4a
MD5 ada1fb7f6b574e8ea123de33d4466786
BLAKE2b-256 f6c1d7d1e5bcdc6f4046832489846cb8ebdeb99fd27c0670fce96e314106efad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tsuki_ux-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 20.0 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 9158a89f18ec75fcb7435ce7334470c7b80c3da393e6e092e8e911d598a065ac
MD5 10aa412a36c1932a1721fa3db1b5acf5
BLAKE2b-256 16ec95a4468689cf391c6c94bd235051854290a77e0e67859af34ce177236bb5

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