Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.dev20261109111457

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.dev20261109111457
File Size Uploaded Provenance Actions
kohakutui-0.2.0.dev20261109111457.tar.gz 813.7 kB With provenance Details for kohakutui-0.2.0.dev20261109111457.tar.gz

Built distributions (wheels)

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

Total release size: 6.1 MB

Release files / kohakutui-0.2.0.dev20261109111457.tar.gz

Download URL kohakutui-0.2.0.dev20261109111457.tar.gz
Size 813.7 kB
Tags Source
SHA-256 checksum
How to use checksums
be150cfae066c8e338e25ab1ad3fa5169468dcb5ec9755cf63e49a2263e15587
BLAKE2b-256 checksum
How to use checksums
33913a547b25f6f2734cffe4060cb171747a84819ee00c6fb94c738e5c1ec5ad
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 9, 2026.

Transparency log

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

Download URL kohakutui-0.2.0.dev20261109111457-cp310-abi3-win_amd64.whl
Size 956.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d4936e73d686bf200e67ef80e017f2b1b1dc340bb9c62aeea0218e8f0efb7f14
BLAKE2b-256 checksum
How to use checksums
983d5556d791e91b162f073b480fd128fda0892f0a2322fbb37103554a1d408f
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 9, 2026.

Transparency log

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

Download URL kohakutui-0.2.0.dev20261109111457-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
ebd0539e449b49b5f5f90ad58a066688c2fd3f4d2b3d9655747baad603906c3d
BLAKE2b-256 checksum
How to use checksums
c5171e9182fd1c6733b63c85e9d31c4e9f43e1096dc2cef2ace34e91786d938f
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 9, 2026.

Transparency log

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

Download URL kohakutui-0.2.0.dev20261109111457-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
28553736a390b35952fb3dd5e03aaa7b5e507cf5a1114aae2718c3d669970998
BLAKE2b-256 checksum
How to use checksums
29448ca3e6e416ef7cd281190ce8d0148f41061875acd2affa0c538a1f7c1e1b
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 9, 2026.

Transparency log

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

Download URL kohakutui-0.2.0.dev20261109111457-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
e437dc74e53bcf59220da0707552a5957d79c11f6f1b0370db7f675ba8dbb421
BLAKE2b-256 checksum
How to use checksums
3edbf8d4eb56f0137a9f700b8996c60233960eb9196b42ce92a0ad2c6f3de2c7
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 9, 2026.

Transparency log

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

Download URL kohakutui-0.2.0.dev20261109111457-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
32778301d63ad17ebe9603267a66634719c0695e63edb7c998aba484ccedd58f
BLAKE2b-256 checksum
How to use checksums
977a2acd74847235f5543cff0c5f1b66bfece5970a856a15f0ac35441ba756fb
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 9, 2026.

Transparency log

Security for kohakutui 0.2.0.dev20261109111457

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.dev20261109111457.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 9, 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