Skip to main content

katui for Python

katui is a Python library for apps, games and documents drawn in pixels inside the terminal.

Install · Guide · Examples · API reference

The katui widget tour: a file tree, a theme select, a switch with a spinner, a slider and a table

It sends pictures to the terminal through the kitty graphics protocol, and through sixel or blocks of colored cells where that is missing. Only what changed between frames is sent. The engine is the katui Rust library, shipped inside prebuilt wheels, so you need no Rust to use it.

import katui
from katui.widgets import label, panel, primary_button


class Counter(katui.App[katui.Action]):
    def __init__(self) -> None:
        self.count = 0

    def view(self) -> katui.Element[katui.Action]:
        return panel(label(f"Clicked {self.count} times"), primary_button("Add one", self.add))

    def add(self) -> None:
        self.count += 1


katui.run(Counter())

Install

katui runs on Linux and macOS with Python 3.14 or newer. Install it into a virtual environment:

python3 -m venv .venv && . .venv/bin/activate && pip install katui

Save the example above as counter.py and run it with python counter.py. A panel shows a line of text and a button. Click the button with the mouse and the count goes up. Press Ctrl+C to quit.

kitty, Ghostty and iTerm2 3.7 show the app at full resolution, and terminals with sixel graphics, like foot, show it as sixel. Other terminals, like macOS Terminal and GNOME Terminal, show the same app in colored block characters at a lower resolution.

Features

  • Widgets: labels, buttons, text fields and areas, lists, tables, trees, tabs, switches, sliders, selects, menus, tooltips, dialogs, toasts, scroll views and split panes, in a dark or light theme or your own.
  • Layout: rows, columns and stacks laid out with flexbox, sized in pixels or in terminal cells so they follow the font size.
  • Documents: katui.html and katui.markdown turn a page into elements, with links that send messages and images you supply.
  • Games: katui.game calls your game 60 times a second to move and then draw it, with shapes, glowing light, text and particles.
  • Tests: katui.testing.Screen draws an app into an image and sends it clicks and keys without a terminal, and frame does the same for games.

A game

from katui import game
from katui.game import Keys, Light, srgb


class Comet(game.Game):
    def __init__(self) -> None:
        self.x = 40.0

    def step(self, keys: Keys, dt: float) -> None:
        self.x += 60 * dt * (keys.is_held("right") - keys.is_held("left"))

    def render(self, light: Light) -> None:
        light.dim(0.8)
        light.glow((self.x, 30), 6, srgb(255, 140, 60))


game.play(Comet())

The left and right arrow keys steer the comet. Q or Ctrl+C quits.

The examples include a to-do list, the full widget tour, a Markdown help screen, an HTML browser and this comet with sparks.

Status

katui is young, and its API can still change between minor versions. The Python package has the same version as the Rust crates and is released together with them. Windows is not supported.

License

katui is licensed under either of the Apache License 2.0 or the MIT license, at your option.

Metadata

Release files for katui 0.3.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 katui 0.3.0
File Size Uploaded Provenance Actions
katui-0.3.0.tar.gz 775.9 kB With provenance Details for katui-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for katui 0.3.0
File Actions
katui-0.3.0-cp314-abi3-musllinux_1_2_x86_64.whl CPython 3.14 abi3 Linux musl 1.2+ x86-64 Details for katui-0.3.0-cp314-abi3-musllinux_1_2_x86_64.whl
katui-0.3.0-cp314-abi3-musllinux_1_2_aarch64.whl CPython 3.14 abi3 Linux musl 1.2+ ARM64 Details for katui-0.3.0-cp314-abi3-musllinux_1_2_aarch64.whl
katui-0.3.0-cp314-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.14 abi3 Linux glibc 2.17+ x86-64 Details for katui-0.3.0-cp314-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
katui-0.3.0-cp314-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.14 abi3 Linux glibc 2.17+ ARM64 Details for katui-0.3.0-cp314-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
katui-0.3.0-cp314-abi3-macosx_11_0_arm64.whl CPython 3.14 abi3 macOS 11.0+ ARM64 Details for katui-0.3.0-cp314-abi3-macosx_11_0_arm64.whl
katui-0.3.0-cp314-abi3-macosx_10_12_x86_64.whl CPython 3.14 abi3 macOS 10.12+ x86-64 Details for katui-0.3.0-cp314-abi3-macosx_10_12_x86_64.whl

Total release size: 22.3 MB

Release files / katui-0.3.0.tar.gz

Download URL katui-0.3.0.tar.gz
Size 775.9 kB
Tags Source
SHA-256 checksum
How to use checksums
df7af4d3fb0568ff1f00dbe1834e83fc8a0df238d8b0c654c73d32a583149a10
BLAKE2b-256 checksum
How to use checksums
ed81e864db96f1bd916aa8d758cc7e3bace7ab75d403bb2037de93c8e494e26a
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 17, 2026.

Transparency log

Release files / katui-0.3.0-cp314-abi3-musllinux_1_2_x86_64.whl

Download URL katui-0.3.0-cp314-abi3-musllinux_1_2_x86_64.whl
Size 3.9 MB
Tags CPython 3.14 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
9b87942221cb28585ce40f790b6a8223ea7bec69d5e4cf583e34512a4a7535ea
BLAKE2b-256 checksum
How to use checksums
b3fbef03171f43f43b48864ecaafe99d5b8c75c21b0870b5815677be261b10f1
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 17, 2026.

Transparency log

Release files / katui-0.3.0-cp314-abi3-musllinux_1_2_aarch64.whl

Download URL katui-0.3.0-cp314-abi3-musllinux_1_2_aarch64.whl
Size 3.8 MB
Tags CPython 3.14 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
2feee376b597459155263eca6c496f586de77be8e0e10214b7d78c28107173c0
BLAKE2b-256 checksum
How to use checksums
2d8bfc7f07501bfc77b9da6767b0429bec2fa561ab0b15d98a3438da473ba8f2
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 17, 2026.

Transparency log

Release files / katui-0.3.0-cp314-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL katui-0.3.0-cp314-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.6 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4b6780dcff7911f8cc9a38887c1f4827a9a8adb04c7adf5e11acbfc700761dc2
BLAKE2b-256 checksum
How to use checksums
6980e9facc6be9a5992294695247d08c04ea7c1ba6a190f961c494a6a24a66d9
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 17, 2026.

Transparency log

Release files / katui-0.3.0-cp314-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL katui-0.3.0-cp314-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 3.6 MB
Tags CPython 3.14 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
6cd117620633244a51d7b86984766e6c454d3ff0e44e5b47f3e93bf6402afef6
BLAKE2b-256 checksum
How to use checksums
67a42013b8958b29dea2635690159603511c89dfeb9ea17fa712268d85873b94
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 17, 2026.

Transparency log

Release files / katui-0.3.0-cp314-abi3-macosx_11_0_arm64.whl

Download URL katui-0.3.0-cp314-abi3-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.14 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dae53d08fe41d8a49a37e18d8cb817b0057087750caee91e706ea3aaa91a9f66
BLAKE2b-256 checksum
How to use checksums
728e25871e535db42b57afdf27a0168676534152135f110db9763fd469999209
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 17, 2026.

Transparency log

Release files / katui-0.3.0-cp314-abi3-macosx_10_12_x86_64.whl

Download URL katui-0.3.0-cp314-abi3-macosx_10_12_x86_64.whl
Size 3.3 MB
Tags CPython 3.14 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5b9285ad77e25c8b99f7390e42f7d23debdd436dadd4e9c3ec12267681d1188f
BLAKE2b-256 checksum
How to use checksums
59fb0ced348f96af53402774d9ce44771f0927bb576d17402f99c581d1e04a40
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 17, 2026.

Transparency log

Security for katui 0.3.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 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for katui-0.3.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 17, 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