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.4.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.4.0
File Size Uploaded Provenance Actions
katui-0.4.0.tar.gz 777.5 kB With provenance Details for katui-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for katui 0.4.0
File Actions
katui-0.4.0-cp314-abi3-musllinux_1_2_x86_64.whl CPython 3.14 abi3 Linux musl 1.2+ x86-64 Details for katui-0.4.0-cp314-abi3-musllinux_1_2_x86_64.whl
katui-0.4.0-cp314-abi3-musllinux_1_2_aarch64.whl CPython 3.14 abi3 Linux musl 1.2+ ARM64 Details for katui-0.4.0-cp314-abi3-musllinux_1_2_aarch64.whl
katui-0.4.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.4.0-cp314-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
katui-0.4.0-cp314-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.14 abi3 Linux glibc 2.17+ ARM64 Details for katui-0.4.0-cp314-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
katui-0.4.0-cp314-abi3-macosx_11_0_arm64.whl CPython 3.14 abi3 macOS 11.0+ ARM64 Details for katui-0.4.0-cp314-abi3-macosx_11_0_arm64.whl
katui-0.4.0-cp314-abi3-macosx_10_12_x86_64.whl CPython 3.14 abi3 macOS 10.12+ x86-64 Details for katui-0.4.0-cp314-abi3-macosx_10_12_x86_64.whl

Total release size: 22.3 MB

Release files / katui-0.4.0.tar.gz

Download URL katui-0.4.0.tar.gz
Size 777.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b48409a27f4f0838794f9c07216f18b6a8d506b46c5c34b3a1f3e44e39558818
BLAKE2b-256 checksum
How to use checksums
40347c851c6c46ef211d15ceb106864b42836fc967d678414a61ce28803f6b50
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 25, 2026.

Transparency log

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

Download URL katui-0.4.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
51f5cc8e03089fcbde92912b25aa7b3e569e7e22c40873d6d25f226d81541333
BLAKE2b-256 checksum
How to use checksums
95af8608348aeeaa1fdd5750ef9d99481f0a8818396286be2a3864d86fadf49a
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 25, 2026.

Transparency log

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

Download URL katui-0.4.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
efb8808b7bb36b92a40187b93074df9c88eafa5601558843d75fbaae893cea79
BLAKE2b-256 checksum
How to use checksums
a262887b6619cdc9effaed27c1882591d95d1cbbe774c391e79fd957a8e0c3ee
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 25, 2026.

Transparency log

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

Download URL katui-0.4.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
3ac72d2bbd6a7afe523dd830c3cdf5d31f27d211b388189a28f20d99ab96b19c
BLAKE2b-256 checksum
How to use checksums
1294da07fe3f9ea0c5156b7c4559b961eb2025f07c758c889c823302990f7e02
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 25, 2026.

Transparency log

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

Download URL katui-0.4.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
d31c0300017aebde8270a4ba3a6a18d17c9d4174554b59dfd016281be413388b
BLAKE2b-256 checksum
How to use checksums
03bdeeb02c877fb7611219effef17868bd5ba7bb826835ccbb13d4bd343635f0
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 25, 2026.

Transparency log

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

Download URL katui-0.4.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
7a0fa81d7a2d04a0b26b3e87b5e8bc8d01898a54f4d6715addc427f71f52030d
BLAKE2b-256 checksum
How to use checksums
700e7bc03c5716722d17ec6421e3becc2b33db25b8f15f183fee75733023becf
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 25, 2026.

Transparency log

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

Download URL katui-0.4.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
0f8e39b1abe861f021fdfe7d9e4b8e60f6e9ffa74f07a890dbb03a864342d50a
BLAKE2b-256 checksum
How to use checksums
954ff5b9420e8f06164c868db1423335f0136c39126cedbe4bf61c851c2d2307
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 25, 2026.

Transparency log

Security for katui 0.4.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.4.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 25, 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