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, Esc 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.0.6

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.0.6
File Size Uploaded Provenance Actions
katui-0.0.6.tar.gz 747.4 kB With provenance Details for katui-0.0.6.tar.gz

Built distributions (wheels)

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

Total release size: 22.1 MB

Release files / katui-0.0.6.tar.gz

Download URL katui-0.0.6.tar.gz
Size 747.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3083fcd88b78e29002bb232621fa30e3e0fd829d11a7b54160ada35edd9e636f
BLAKE2b-256 checksum
How to use checksums
0a421fbee8568c9d9952a493aa3926f32e606daa73af51714427ce9ec16de47f
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 16, 2026.

Transparency log

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

Download URL katui-0.0.6-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
9cdac326a5ceb45c471ed91c6efd2a46bf50e432fa4333a6caaaa4cc61124092
BLAKE2b-256 checksum
How to use checksums
68e92b9bd756d4b4d417235beadfa0d9c3738a5926e7c207126bf878a891ac5a
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 16, 2026.

Transparency log

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

Download URL katui-0.0.6-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
c37492a077f61bfb16d39b0ac4d790f590a178620f936a4f69e859603e382ee3
BLAKE2b-256 checksum
How to use checksums
4d9a0fde82990510ba57f47dd44f45e9c8e894e7fe4a29a09df16245737f673a
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 16, 2026.

Transparency log

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

Download URL katui-0.0.6-cp314-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.5 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
dd2d04ba8f8010e6099526975a6829d274d55d2cdf6168e2877a6c2284a42e69
BLAKE2b-256 checksum
How to use checksums
24ceb284737b04831847e93be2751e8aac1c5eac5686c705b234fc779bbee7cc
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 16, 2026.

Transparency log

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

Download URL katui-0.0.6-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
78e30f8993244101cc6b3c6cc42e77d523a071a95a585b4949b8770813d3455c
BLAKE2b-256 checksum
How to use checksums
19220b1eb2fdf4766f37affa2dd3efdfd2a3380256cffe61dce5ca97e61db884
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 16, 2026.

Transparency log

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

Download URL katui-0.0.6-cp314-abi3-macosx_11_0_arm64.whl
Size 3.2 MB
Tags CPython 3.14 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f4a38266060a7fc9a1166823e8f4406a26c04b8045f2db9c141903e57cfb9baa
BLAKE2b-256 checksum
How to use checksums
ebb2ab8f3a6e4b956748e19ad6341d599f4c7aac4bc109f57a6ab9838dd74a69
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 16, 2026.

Transparency log

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

Download URL katui-0.0.6-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
1d48ae8b60393fc831f19136048cdf896039f6672ec88d97bd37d3cf3814afb8
BLAKE2b-256 checksum
How to use checksums
7bf0984d798f8ca7ed4631f070d48f8d0e47181b32c4001d5671f92fe2fd7791
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 16, 2026.

Transparency log

Security for katui 0.0.6

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.0.6.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 16, 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