Skip to main content

Zero-dependency POSIX terminal UI toolkit: truecolor ANSI with 256/16/mono fallback, raw keyboard input, diff-based renderer, styled canvas, and widgets.

Project description

puretui

A zero-dependency, pure-stdlib terminal UI toolkit for Python (POSIX).

A styled cell-grid canvas with clipped regions, truecolor ANSI with 256/16/mono fallback, flexbox-style layout, raw keyboard + mouse input (bracketed paste, focus events), a flicker-free diff renderer, procedural widgets, an app kit (views, keymaps, command palette), and snapshot testing — in about 3,000 lines you can read in an afternoon.

from puretui import Canvas, Fixed, Flex, Theme, run
from puretui import widgets

def render(cols, rows, frame):
    cv = Canvas(cols, rows, widgets.base_style())
    root = cv.region()
    head, body = root.split_v(Fixed(2), Flex(1))
    head.left("hello, puretui", r=0)
    head.rule(r=1)
    body.center("q to quit", r=body.h // 2)
    return cv.to_lines()

run(render, on_key=lambda k: k not in ("q", "Q"))
  • Zero dependencies. Python 3.8+ standard library only. POSIX (macOS/Linux).
  • Explicit. Procedural drawing, plain data, no reactivity, no magic.
  • Tested. 600+ unit tests, property tests, a fuzzed input decoder, and byte-exact golden snapshots.
  • Fast. ~2ms full frames at 120x40; steady-state frames ~0.015ms (python3 benchmarks/bench.py for numbers on your machine).

Install

pip install puretui

Examples

python3 examples/dashboard.py    # layout, tables, sparklines, mouse
python3 examples/logtail.py      # app kit: views, filter capture, palette

Status

Pre-1.0: the API is stabilizing (__all__ defines the public surface; see CHANGELOG.md). Built as the engine of a World Cup terminal dashboard — the flagship consumer that keeps every release honest with byte-identical rendering oracles.

License

MIT

Project details


Download files

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

Source Distribution

puretui-0.6.0b1.tar.gz (90.7 kB view details)

Uploaded Source

Built Distribution

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

puretui-0.6.0b1-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

Details for the file puretui-0.6.0b1.tar.gz.

File metadata

  • Download URL: puretui-0.6.0b1.tar.gz
  • Upload date:
  • Size: 90.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for puretui-0.6.0b1.tar.gz
Algorithm Hash digest
SHA256 35084abb9fd2ad5fb21bb9ad75c69c5aaceb750fbcf00820833fd7abed4ccb29
MD5 d88c9cda6d5c7770c6ec69b2f184c0b0
BLAKE2b-256 58bbfd22a2f4c02a03293115f3238e7433b7375f91dae6fa399f47a6a2af9dd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for puretui-0.6.0b1.tar.gz:

Publisher: release.yml on 0JamesAB/puretui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file puretui-0.6.0b1-py3-none-any.whl.

File metadata

  • Download URL: puretui-0.6.0b1-py3-none-any.whl
  • Upload date:
  • Size: 45.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for puretui-0.6.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 233c7c8ae1d6eff2d974016ac4026167968f7e485a1ca4e14871d06a93caa210
MD5 401a4b88d06ddf385b5e08251e1bfb30
BLAKE2b-256 5cbf0094ba37ead9b74ec430bdf785964075bb28ecba1526010c0243033e45fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for puretui-0.6.0b1-py3-none-any.whl:

Publisher: release.yml on 0JamesAB/puretui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page