Skip to main content

A lightweight and modular terminal UI engine. Designed to make building interactive terminal interfaces simple and structured.

Project description

🧱 TUIX Core 0.2.1


🧩 Overview

TUIX is a modular terminal UI engine inspired by web technologies.
It introduces a DOM-like component system, a layout engine, and a buffer-based rendering pipeline for building structured and styled terminal interfaces.

v0.2.1 ships a compiled C + Cython core for low-latency rendering, four built-in widget builders (progressbar, choice, input, canvas), and a clean Python API layered on top.

🆕 What's New In 0.2.1

  • Packaging/build consistency improvements for Windows and editable installs.
  • New scene focus primitives in Python API: scenes.set_focus(...) and scenes.set_previous_focus(...).
  • New multimodal example: examples/multimodal/focus_routing.py.
  • Examples reorganized by domain: widgets/, multimodal/, showcase/.
  • Extended test coverage for focus APIs and examples layout integrity.

Core vs Framework: TUIX provides a low-level engine core - not a high-level application framework. The public API intentionally exposes low-level primitives and is not designed to be "simple" by itself; higher-level, user-friendly frameworks will be built on top of this core once it has matured and stabilised.


🚀 Installation

pip install tuix-core

Requires Python ≥ 3.10. Pre-built wheels are provided for Windows/Linux/macOS (AMD64, x86, ARM).
Building from source also requires Cython ≥ 0.29 and a C compiler.


⚡ Quick Start

from tuix.core import engine, builders, scenes, registry, objects, buffers, input

engine.init()
builders.register_standard()

scenes.init_scene(b"Main")
registry.registry.current_scene_name = b"Main"
input.listen()

# create a progressbar and animate it
uid = objects.create_object(builders.PROGRESSBAR, b"Main", 0.7, 0.08, 0.45, 0.15)
ptr = buffers.get_buffer_by_uid(uid)
obj = ptr.contents.obj.contents

for i in range(101):
    objects.tuix_progressbar_set_value(obj, i / 100.0)
    engine.main_loop()

buffers.free_buffer(b"Main", uid)
input.stop()
engine.shutdown()

🧩 Widgets

Builder constant What it renders
builders.PROGRESSBAR Horizontal fill bar with customisable chars and colours
builders.CHOICE Keyboard-navigable list menu
builders.INPUT Single-line text input with placeholder support
builders.CANVAS Free-draw surface - pixels, lines, rects, circles, text, sprites

Progressbar

objects.tuix_progressbar_set_value(obj, 0.75)          # 0.0 – 1.0
objects.tuix_progressbar_set_style(obj,
    ord('#'), ord('-'),          # fill char, empty char
    120, 220, 80,                # fill RGB
    50,  50,  50)                # empty RGB

Choice

objects.tuix_choice_set_options(obj, [b"Yes", b"No", b"Maybe"])
objects.tuix_choice_feed_input(obj, snap)       # snap = input.get_snapshot()

if objects.tuix_choice_is_confirmed(obj):
    idx = int(objects.tuix_choice_get_result(obj))

Input

objects.tuix_input_set_placeholder(obj, b"Type here...")
objects.tuix_input_feed_input(obj, snap)

if objects.tuix_input_is_submitted(obj):
    text = objects.tuix_input_get_result(obj)   # bytes

Canvas

objects.tuix_canvas_draw_rect  (obj, x, y, w, h, b'#', filled=1, r, g, b, br, bg, bb)
objects.tuix_canvas_draw_circle(obj, cx, cy, radius, b'O', filled=0, r, g, b, br, bg, bb)
objects.tuix_canvas_draw_line  (obj, x0, y0, x1, y1, b'/', r, g, b, br, bg, bb)
objects.tuix_canvas_draw_text  (obj, x, y, b"hello", r, g, b, br, bg, bb)
objects.tuix_canvas_set_pixel  (obj, x, y, b'*', r, g, b, br, bg, bb)

📁 Examples

Runnable examples are in the examples/ directory:

File Description
examples/widgets/progressbar_dual.py Two bars filling at different speeds
examples/widgets/choice_palette.py Colour palette menu, prints chosen RGB to stdout
examples/widgets/canvas_bounce.py Animated bouncing ball with colour cycling and FPS counter
examples/multimodal/focus_routing.py Keyboard + mouse focus routing between choice and input
examples/showcase/sequential_journey.py Full sequential demo (progressbar → choice → input → canvas)
python examples/widgets/canvas_bounce.py

📚 Documentation

Full documentation is available at: https://docs.custosh.dev/docs/tuix-core


🧪 Tests

pip install pytest
pytest

39 tests covering engine lifecycle, scene management, registry, multimodal focus APIs, all four widget builders, canvas draw calls, and examples layout integrity.


📊 Benchmarks

Benchmarked against blessed, terminal-kit, Ink, ReziTUI, Bubble Tea, Ratatui, OpenTUI.Core, OpenTUI.React, TUIX.Renderer, Rich, Urwid, PromptToolkit on Windows 10 (12th Gen i5-12450HX, 24 GB RAM).

Note to Rezi: Hope you don't mind that I took your benchmarks and reproduced them here - thanks for the reference and inspiration.

Expanded benchmark runs now include CI95 intervals and two byte metrics:

  • Bytes(local): bytes reported by each framework's own counters.
  • Bytes(pty): observed PTY bytes for cross-framework comparison.

Startup

Framework Mean ops/s Peak RSS
TUIX.Core 176µs 5.7K 4.0 MB
TUIX.Python 177µs 5.7K 18.2 MB
Ratatui 258µs 3.9K 27.0 KB
ReziTUI 201µs 5.0K 78.4 MB
Ink 3.74ms 268 62.3 MB
Blessed 31.80ms 31 149.5 MB

Tree Construction (1 000 items)

Framework Mean ops/s
TUIX.Core 49µs 20.2K
OpenTUI.Core 103µs 9.7K
TUIX.Python 140µs 7.1K
Ratatui 1.18ms 847
Bubble Tea 1.23ms 811
Ink 79.91ms 13

Re-render

Framework Mean ops/s
TUIX.Python 11µs 88.6K
TUIX.Core 13µs 75.6K
Blessed 30µs 33.6K
Ratatui 66µs 15.1K
Bubble Tea 121µs 8.3K
Ink 1.03ms 966

Virtual List (100 000 items, viewport 40)

Framework Mean ops/s Peak RSS
TUIX.Core 13µs 80.0K 4.1 MB
OpenTUI.React 42µs 24.0K 38.9 MB
TUIX.Python 62µs 16.0K 18.5 MB
Ratatui 82µs 12.2K 27.0 KB
Ink 1.54ms 651 347.4 MB

Terminal Full UI (120x40, 24 services)

Framework Mean ops/s Peak RSS
TUIX.Core 33µs 30.5K 4.6 MB
TUIX.Python 82µs 12.1K 19.0 MB
Ratatui 393µs 2.5K 27.0 KB
Bubble Tea 608µs 1.6K 24.8 MB
OpenTUI.Core 689µs 1.5K 36.7 MB
Ink 2.60ms 385 348.7 MB

Across the expanded suite, TUIX.Core leads key throughput-heavy scenarios (tree build, virtual list, and full UI composition), while TUIX.Python and TUIX.Renderer stay highly competitive in low-latency rerender paths. Peak RSS remains low for TUIX variants compared with most JavaScript/Python UI stacks.
Full results with CI95 and byte-output columns are in BENCHMARKS.md.


⚙️ Architecture

tuix.core
├── engine.py       init / shutdown / main_loop
├── scenes.py       scene create / free / clear
├── registry.py     active scene pointer
├── builders.py     builder name constants + register_standard()
├── objects.py      widget API (progressbar / choice / input / canvas)
├── buffers.py      buffer lookups
├── input.py        input listener + snapshot
├── _structs.py     ctypes mirror of C structs
└── _tuix_cy.pyx    Cython extension - all C calls go through here

The C core handles layout geometry, compositing, and rendering to the terminal. Python only drives the loop and feeds input.


⚙️ Future Plans

  • Scrollable containers and nested layouts
  • Theme / style system
  • Async-friendly loop integration

Support / Donate

If you enjoy using TUIX, you can support its development:


📜 License

MIT License © 2026 custosh

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

tuix_core-0.2.1.tar.gz (266.7 kB view details)

Uploaded Source

Built Distributions

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

tuix_core-0.2.1-cp313-cp313-win_amd64.whl (406.9 kB view details)

Uploaded CPython 3.13Windows x86-64

tuix_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

tuix_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl (577.1 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

tuix_core-0.2.1-cp312-cp312-win_amd64.whl (407.5 kB view details)

Uploaded CPython 3.12Windows x86-64

tuix_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

tuix_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl (582.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

tuix_core-0.2.1-cp311-cp311-win_amd64.whl (408.2 kB view details)

Uploaded CPython 3.11Windows x86-64

tuix_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

tuix_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl (585.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

tuix_core-0.2.1-cp310-cp310-win_amd64.whl (407.4 kB view details)

Uploaded CPython 3.10Windows x86-64

tuix_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

tuix_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl (586.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file tuix_core-0.2.1.tar.gz.

File metadata

  • Download URL: tuix_core-0.2.1.tar.gz
  • Upload date:
  • Size: 266.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tuix_core-0.2.1.tar.gz
Algorithm Hash digest
SHA256 135915a7cf17bd9e08991e253d16ee5083b3a6773c7c6a2d1bd4d7df410f85cd
MD5 ffe6d3c33f6ef12e47d464fc10f87bbe
BLAKE2b-256 c31949a8ccb1844cc6a8b18b472c95153079d721cdd97d7263e50dd2d3d13c5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1.tar.gz:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: tuix_core-0.2.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 406.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tuix_core-0.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 76fce84c64f9661934d2949a5e25d6a69cc524e327e1fa6206ac5f2307968c55
MD5 f99abbb665eb173fda05770d445d4691
BLAKE2b-256 83efe68d671c5aa3577125a47e798e99e3b974791f2923e62003705182505efd

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp313-cp313-win_amd64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5be1b90698e9771a3476da6aceab99520b821b401e2f879a5d5a14f64511c82
MD5 8dde6dc3953a49d4076e49f3f67157a8
BLAKE2b-256 0440a79c8d1cd9f550fd4e111f595c32594de4b82aff0801d61c766c55b7eeb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 cdcb868a9bc46eb7ca9220c6e52cb569bd3387308f8ca95e8895e8a70671c2e3
MD5 1a4ad754815f0fa24a886dfa41984c46
BLAKE2b-256 5552defada58ebbef9d016bef20b4972a7fd4e2f896cd69a0e95f706b938155c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: tuix_core-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 407.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tuix_core-0.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bbfbd014953d9d44c0f814f560e04822100753781808542c777d9fd3ee5cd37d
MD5 3d408ee86cabba92cc33f7fe43189b27
BLAKE2b-256 590a66122de235917db3e51671eb119fccacb04291c84e2f8b17b7f4816f37bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp312-cp312-win_amd64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcbf5fb368252c67309c195cdc8efe3ef9155addf3c472a12297842cda803a09
MD5 eee68c5fef1a7bc5c11a5176144069c7
BLAKE2b-256 fa07209a2e541c8bb6b8f0557bf736d1ae1345e7763534be4a9c855bd9016983

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 04c7dfeb2cc66db58ffd10f8c3dbdc1f47b4d4ac80e3d1fe504e3cf8f9cf0370
MD5 a65dc1b1283c4472802a0893373979b1
BLAKE2b-256 703f35388453d9658512e2f3db2d346106f8009e5403a7c2c3d53c4ff390e9bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: tuix_core-0.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 408.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tuix_core-0.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1189aefd868129396d4ba1c92595690b7148eb10f4f26b5050430baa1755e759
MD5 f7becfc3c6643d68ea9e86c049152762
BLAKE2b-256 1805417ef90d8bd6898ddaab8c3f5e3fb1ddcdff0a1b0c6b62ec658840b87c99

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp311-cp311-win_amd64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7be7706de288ebafa29961df0ff868240790398705cc41e2c93ce611b0728578
MD5 f78e4a629ea0f280b207914c7aac38cd
BLAKE2b-256 edc25f1f79728ac61f16f66f53990c6ecd72b302cbf440e923f3e9167408495d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 fba3e0dfb82b04ed7ab04f44e59db13376b8154601217f888d6971f5af6182c2
MD5 f75633f93994dfc8037864c2ab0abbb0
BLAKE2b-256 78d2dcde4ea8f12b832feb6e70b46e934f6b464544f0945fd62d67db27af3cc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: tuix_core-0.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 407.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tuix_core-0.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 81d51e30cb64165e232885ee3a05f9156a80556cde4d4aeab8432e08b587a7ed
MD5 8512a1b1ccedb14c7bac92ca40d2c75d
BLAKE2b-256 acdb5c9dd8feb85e2e94b276f5eb05252952ca7320e1945843760d279f2cad0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp310-cp310-win_amd64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5aa2aeb8f65e123c15ca08a36567d9708d45ce2066a4ae918da5de00591e18aa
MD5 8cdb9567e2e1fc36e74464439aa7d809
BLAKE2b-256 4949ba20c939c24d85737d12c949355022f95d1f52ed7f3d8994848b7f35b7ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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

File details

Details for the file tuix_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tuix_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 1787b00c33fc438b9102ef4bdf457063b2c579dcde6215049b0cbe97e15ec593
MD5 168004adf6caf2841794228ca5201879
BLAKE2b-256 afb0cb518b4687e130aae5691777cdaf5d203d6c99f72ebba1b558799adb283e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuix_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl:

Publisher: build.yml on anonim1321/build-tuix-core

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