Skip to main content

PuiKit

PuiKit is a capability-based Python UI framework that supports both TUI (terminal) and GUI (desktop, web) backends. Build apps and widgets once, run them on multiple backends without splitting implementations.

  • Apps and widgets specify what to draw (intent)
  • How to draw (implementation) is decided by the backend
  • Backends declare their capabilities; the Panel layer resolves fallbacks
  • Widget code never branches on TUI/GUI

See the documentation for design notes and per-system guides (layout, rendering, color, animation, fonts, widgets, and more).

Screenshots

The bundled demo catalog, running unchanged on the macOS GUI backend and in a terminal (curses backend).

macOS GUI backend Curses (terminal) backend
Widgets page of the demo catalog on the macOS GUI backend Widgets page of the demo catalog on the curses TUI backend
MarkdownView page of the demo catalog on the macOS GUI backend MarkdownView page of the demo catalog on the curses TUI backend
Modal confirm dialog with drop shadow and dimmed backdrop on the macOS GUI backend Modal confirm dialog with shadow and dimmed backdrop on the curses TUI backend

Apps built with PuiKit

  • XeFM — a dual-pane file manager that runs as a native desktop app on Windows and macOS, and in the terminal on all platforms, from a single codebase. PuiKit's first and most demanding user: archive / SFTP / S3 browsing, rich built-in viewers, and themes with GPU background shaders and CRT post effects.
  • Keyhac 2 — Python-scriptable keyboard customization for Windows and macOS, successor to Keyhac for Windows and Keyhac for macOS. Its UI is built on PuiKit.

Building something with PuiKit? Open an issue or PR to get it listed here.

Status

Stable release (1.0). Implemented:

  • Core framework: Panel, Backend interface, capability profiles, event model
  • Layout system: HSplit / VSplit / Item with weights and min_px / min hints — snapped to whole base units on TUI, resolved at pixel granularity on GUI
  • Animation: panel.animate(widget, hints={"transition": "fade", "duration_ms": 200}) — transitions fade (opacity), slide (position), scale (visual zoom), size (layout reflow), and highlight (color) rendered on the macOS backend; immediate switch on TUI
  • Widgets: Label, ListView, ScrollBar, Container
  • Widget tree: containers nest widgets with hierarchical clipping; animations on a parent cascade to all descendants, while children stay individually animatable
  • Backends:
    • CursesBackend — TUI, all platforms
    • MacOSBackend — macOS native GUI (PyObjC, installed automatically on macOS)
    • WindowsBackend — Windows native GUI (raw ctypes; Direct2D/DirectWrite)
    • WebBackend — runs in a web browser, launched with webbrowser over a local WebSocket (--backend web; see docs/web_backend.md)
    • MemoryBackend — headless, for tests
  • Planned next: C++ CoreText render extension

Quick start

pip install puikit

That's all you need — the base install ships a working TUI on every platform, and a native window on macOS (PyObjC installs automatically; on Windows the curses backport installs automatically). The minimal app below then runs as-is, with no repository checkout required.

Want to see it move right away? The hello-world example is a single self-contained file — download and run it without cloning the repo:

curl -O https://raw.githubusercontent.com/crftwr/puikit/main/examples/hello_world/main.py

python3 main.py                  # TUI — in a terminal, any platform
python3 main.py --backend gui    # native window — macOS
python3 main.py --backend web    # opens a browser tab — any platform

Minimal app

from puikit import EventType, Panel
from puikit.backends import create_backend
from puikit.widgets import Label

backend = create_backend("tui")
with backend:
    panel = Panel(backend)
    panel.add(Label("Hello, PuiKit!"), x=2, y=1, w=30, h=1)
    panel.render()

    def on_event(event):
        if event.type is EventType.KEY and event.key == "q":
            backend.quit()
            return
        panel.dispatch_event(event)
        panel.render()

    backend.run_event_loop(on_event)

Run it in a terminal for the TUI backend, or pass --backend gui (macOS) / --backend web (any platform) if you wire up argument handling like the bundled examples.

Development (from source)

Clone the repository, then install editable with the dev extras:

python3.14 -m venv .venv
.venv/bin/pip install -e ".[dev]"

# Run the examples (in a terminal)
.venv/bin/python examples/hello_world/main.py
.venv/bin/python examples/demo_catalog/main.py

# On macOS, the same examples in a native window
.venv/bin/python examples/hello_world/main.py --backend gui
.venv/bin/python examples/demo_catalog/main.py --backend gui

# Or in a web browser (opens a tab; works on any platform)
.venv/bin/python examples/demo_catalog/main.py --backend web

# Run the tests
.venv/bin/python -m pytest

Contact & Support

License

See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

puikit-1.4.2.tar.gz (29.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

puikit-1.4.2-py3-none-any.whl (29.1 MB view details)

Uploaded Python 3

File details

Details for the file puikit-1.4.2.tar.gz.

File metadata

  • Download URL: puikit-1.4.2.tar.gz
  • Upload date:
  • Size: 29.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.7

File hashes

Hashes for puikit-1.4.2.tar.gz
Algorithm Hash digest
SHA256 f0d4a9bbd32580032d5e7064341d100c550d3324d9d793611d8de2e38197cdeb
MD5 cf0b715f9e9d198021084ab0a311483a
BLAKE2b-256 eac6065ba8eb8851220a7fb7c134a1c4d4e85179a9727b58d0475413b1080b52

See more details on using hashes here.

File details

Details for the file puikit-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: puikit-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 29.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.7

File hashes

Hashes for puikit-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 715f5af340bedab723c1a86804e15d16a311c856e0cf5c62f2b503318caee917
MD5 49857e9a19e30051e5e8168afa25ce8e
BLAKE2b-256 ca8fac17d809e1f88407b05266b8e9e76def57994396c5d40dc1ee21212ade55

See more details on using hashes here.

Release history Release notifications | RSS feed

1.5.1

2 files

1.5.0

2 files

1.4.3

2 files

This release

1.4.2 This release

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.12

2 files

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

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