Skip to main content

KohakuTUI

PyPI Python License

Terminal UIs for Python, rendered by Rust. Training monitors, dashboards, interactive CLI tools, log viewers, chat front ends: describe what is on screen as a tree of nodes, and the Rust engine owns the terminal, the frame loop and every keystroke. Live output never flickers, input stays responsive while your Python code is busy, and finished output lands in the terminal's real scrollback, so it can be scrolled, searched and copied like any command's output.

A full-screen training dashboard: progress bars, loss, learning-rate and grad-norm charts, an eval table and a GPU panel

Every image here is real output: the demos run headless and scripts/screenshots.py paints the emulated terminal's cells.

Why

  • Inline and full screen, same code. Inline mode keeps a small live area at the bottom and writes everything finished into scrollback, as pip, cargo or a training script would, only it can redraw. Full screen gives you panes, scrolling and the mouse. ctrl+t switches between them at runtime.
  • Rust where it matters. Layout, wrapping, Markdown, charts, frame diffing and key reading run in Rust on their own thread. Python sends small batches of changes and gets meaningful events back (submit, select, close), never raw key codes.
  • Things you would otherwise build yourself. Live charts and sparklines, progress bars with rate and ETA, tables, logs, streamed Markdown, foldable sections, pickers with sections and options, prompts, cards, a full input editor with history and commands.
  • Nothing traps the user. Dialogs open where the input is, typing keeps working, and esc always gets you out.
  • Testable. Every app runs headless on an emulated terminal (App(backend="test")): a test types keys and reads exactly what a user would see.
  • No runtime dependencies. One abi3 wheel per platform, CPython 3.10 and newer.

Install

pip install kohakutui

Wheels for Linux (x86_64, aarch64), Windows (x86_64) and macOS (Apple silicon, Intel).

Try it

python -m kohakutui demo dashboard  # full-screen training monitor: charts, eval table, GPU panel
python -m kohakutui demo train      # inline training: live chart and progress, results in scrollback
python -m kohakutui demo chat       # streamed Markdown, an input box, a picker
python -m kohakutui demo agent      # a coding-assistant session: foldable steps, an approval card,
                                    # background tasks (↓ or ctrl+b)
python -m kohakutui reset           # fix a terminal left in raw mode

Quick start

A training loop with a live chart and progress bar that leaves the final curve in scrollback:

import random
import time

import kohakutui as ktui

with ktui.App() as app:
    info = ktui.KV(fields={"model": "tiny-mlp", "steps": "300", "lr": "1e-3"})
    app.transcript.add(ktui.Cell(role="system", title="run started", children=[info])).seal()

    chart = app.live.add(ktui.Chart(label="loss", height=8, unit="step"))
    bar = app.live.add(ktui.Progress(total=300, label="train", unit="step"))

    loss = 2.0
    for step in range(1, 301):
        loss = max(0.05, loss * 0.99 + random.gauss(0, 0.02))
        with app.batch():  # one frame for both changes
            chart.append(loss)
            bar.append(step)
        time.sleep(0.01)

    bar.remove()
    chart.move(app.transcript)  # the finished curve goes to scrollback
    chart.seal()
    if app.confirm(f"Final loss {loss:.3f}. Save a checkpoint?", default=True):
        app.transcript.add(ktui.Text("saved ckpt-300.pt", tone="ok")).seal()

The screen is five regions, each a node you add children to:

Region Inline mode Full-screen mode
app.transcript sealed nodes go to real scrollback the scrollable main pane
app.live what is happening now: charts, progress, spinners under the main pane
app.bottom input, status rows, footer bottom
app.panels hidden right-hand pane
app.overlays dialogs dialogs

Nodes change with update(**props), stream with append(data), finish with seal() and move with move(parent). Input arrives as events: @app.on(kind, node), for ev in app.events() or async for ev in app.aevents(). The getting started guide builds an interactive app step by step.

An inline training run: live loss chart, progress, stats and epoch table A picker with a section sidebar and option chips
Inline live area. The chart, progress, stats and epoch table redraw in place; the run's header is already in scrollback above them, and the final results go there once. Pickers. Fuzzy filter, a section sidebar, per-item options and focus areas: ←/→ move between sections, list and options, ↑↓ act on the focused one.
A confirmation card docked where the input box was A chat session with folded steps and background tasks
Dialogs that never trap. A card, question or picker opens where the input box is; esc gives the input back, and the program keeps running behind it. Chat and assistant front ends. Streamed Markdown, foldable steps (ctrl+o), grouped tool calls and background tasks under the input.

Features

  • Data: line charts over a whole run, sparklines, progress bars with rate and ETA, tables, key/value lists, scrolling logs (\r progress lines work), code blocks.
  • Text: Markdown (streamed or whole), styled text, foldable cells with summaries, scroll boxes, grouped entries ("5 tool calls"-style batches).
  • Input: a multi-line input box with history and a command popup, buttons and segmented rows, pickers (filter, sections, multi-select, options), prompts (also secret input), confirmations, cards.
  • Full screen: wheel scrolling, clickable and keyboard-navigable folds, hover, drag to select and copy (OSC 52), a side panel.
  • Themes: eight schemes (kohaku-dark, kohaku-light, tokyo-night, solarized-*, colorblind-*, terminal), truecolor with a 256-colour fallback, switchable at runtime.
  • Capture: print and logging output goes into the transcript instead of tearing the screen (app.capture_stdio(), app.capture_logging()).
  • Threads and asyncio: any thread may update the screen; dialogs have blocking and await forms.

Documentation

Page What it covers
Getting started Install, a first interactive app, modes, events, threads and asyncio
Concepts Regions, nodes, sealing and scrollback, how a frame is made
Components Every component and its props
Dialogs and input Pickers, prompts, cards, docking, keys
Themes Schemes, colour roles, overrides, truecolor
Testing The headless backend: inject input, read the screen, screenshots
Releasing CI, nightlies, stable releases, PyPI trusted publishing

KohakuTUI drives the terminal front end of KohakuTerrarium, and is planned for the CLI of KohakuBoard.

Development

Requires a stable Rust toolchain and Python 3.10+.

uv venv
uv pip install -e ".[dev]"     # maturin builds kohakutui._rs into the venv
python -c "import kohakutui; print(kohakutui.version())"

After changing Rust code, run uv pip install -e ".[dev]" again (or maturin develop).

pytest tests/ -q                                     # Python: unit, integration, e2e, static
cargo test --no-default-features                     # Rust: every stage
cargo fmt --check && cargo clippy --all-targets --features python -- -D warnings
black --check src/ tests/ scripts/ && ruff check src/ tests/ scripts/
uv run --with pillow --with fonttools python scripts/screenshots.py   # regenerate the images
src/kohakutui-rust/   the engine crate (kohakutui._rs with the `python` feature)
src/kohakutui/        the Python SDK
tests/                static contracts + e2e / integration / unit (see tests/README.md)
docs/                 user documentation and the README images
scripts/              release versioning, screenshots

Contributor rules are in CLAUDE.md.

License

Apache-2.0. See LICENSE.

Metadata

Release files for kohakutui 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kohakutui 0.2.0
File Size Uploaded Provenance Actions
kohakutui-0.2.0.tar.gz 813.5 kB With provenance Details for kohakutui-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kohakutui 0.2.0
File Actions
kohakutui-0.2.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for kohakutui-0.2.0-cp310-abi3-win_amd64.whl
kohakutui-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for kohakutui-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
kohakutui-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for kohakutui-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl
kohakutui-0.2.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for kohakutui-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
kohakutui-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for kohakutui-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 6.1 MB

Release files / kohakutui-0.2.0.tar.gz

Download URL kohakutui-0.2.0.tar.gz
Size 813.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fbf1fac661c4caf2493afab1dd2431e21fe0438d127df6cc4c87fb268ec7b333
BLAKE2b-256 checksum
How to use checksums
d36b91e69a84679e944ad8fa1285f5b6ccd895df522b34c79a2fe9edffed0d65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / kohakutui-0.2.0-cp310-abi3-win_amd64.whl

Download URL kohakutui-0.2.0-cp310-abi3-win_amd64.whl
Size 955.6 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
717489f42dbb8935c35ac79f6273159928092b93a78e8ac724c5cd9dacea6304
BLAKE2b-256 checksum
How to use checksums
a55b5142c4724e04e7b315f44cd23a1d4690f79da10d50061377f2dbe259efc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / kohakutui-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL kohakutui-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
80105eb948103f5fc72455767baa7257f16ff62edabccb53b4a765df6194fec5
BLAKE2b-256 checksum
How to use checksums
702c82842c9cd5c683ebaa3a1e445092628cb373d052b303ee81103b0189633b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / kohakutui-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL kohakutui-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 1.1 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
275d2513bb5232ed5fd076e2ef45fd02fd87645f8938b32386dce8f22589a1d8
BLAKE2b-256 checksum
How to use checksums
5aacf94b08cd6197b4e94ddbeed11933b8c336df48c9f6535c5c0a4b1e7e85ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / kohakutui-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL kohakutui-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 1.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
576f59b0749f8115b496c1b07c7012933af482af064ca859ff81caadd3b2449d
BLAKE2b-256 checksum
How to use checksums
6c381ca2cb74578b74763918e52e9475cf320b477082a6929ae37f08a04e11ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / kohakutui-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL kohakutui-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d240056bea52943253b052d7f12943ee72888d04081f479d837d0be339e7d7ea
BLAKE2b-256 checksum
How to use checksums
03dbf9c360eba563dc7a1124061f9a0a9c04d9388e48b2f7c85f150235367f5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for kohakutui 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for kohakutui-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page