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.11.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.11-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tsuki_ux-1.0.11.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.11.tar.gz
Algorithm Hash digest
SHA256 cefece8d07887035329699dda9109a137a8de88553e7a60a8418fe5a8a6783a6
MD5 5c8ea1d2170f5ec5a3274f7808039502
BLAKE2b-256 7d068b4148dac2cdf9fe2c30f82d923e6e733aec7402887aff0569ee24306d9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tsuki_ux-1.0.11-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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 cce99785d2a2b7bacc78255ba012b7553ce81ce39411fdc66d96ba969390462f
MD5 f325f3ff40d427bd49d7fba3883f908a
BLAKE2b-256 50129c414c9d9d2131fa38e532f59e9305a3f3fb18d426d9cc363c8ef2ad0194

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