Skip to main content

A simple python **tui** framework built on top of the ``[ratatui](https://ratatui.rs)`` and ``[tachyonfx](https://github.com/ratatui/tachyonfx)`` rust crates.

Project description

xnano

A simple python tui framework built on top of the ratatui and tachyonfx rust libraries.

[!IMPORTANT] The xnano library is currently going through a complete rebuild of it's primary purpose and API. As the package is still in beta, expect frequent changes from all package versions 0.99.xx and above until the stable 1.0.0 release.

Docs will soon be available at: xnano.hammad.app.

xnano is a zero dependency (aside from rust crates) python library that ports various capabilities of the ratatui and tachyonfx rust terminal UI libraries into an API that aims to feel as pythonic as possible.


Examples

Agent Chat

View Example

Example

Dashboard

View Example

Example

Effects Demo

View Example

Example

Tab Navigation

View Example

Example


Quick Start

import time
from xnano.terminal import Terminal

with Terminal() as terminal:
    start_time = time.time()
    frames = 0
    while time.time() - start_time < 3.0:
        frames += 1
        elapsed = time.time() - start_time
        fps = frames / elapsed if elapsed > 0 else 0.0

        # Draw a large screen of dynamic text instantly (~200+ updates per second)
        # Behind the scenes, this compiles directly to a native Rust frame buffer!
        terminal.draw(
            f"  Demo Application\n"
            f"  ==================================\n\n"
            f"  Frame: {frames}\n"
            f"  Elapsed: {elapsed:.2f}s\n"
            f"  Speed: {fps:.1f} FPS\n\n"
            f"  This runs synchronously with zero frame-dropping lag."
        )
        time.sleep(0.005)

2. Shorthand Named Layouts

import time
from xnano.terminal import Terminal
from xnano.widgets import Block
from xnano.layout import Layout

# Explicitly define named layout regions using a dictionary
layout = Layout(
    direction="vertical",
    constraints={
        "header": 3,
        "body": "fill",
        "footer": 3
    }
)

with Terminal() as terminal:
    start_time = time.time()
    while time.time() - start_time < 3.0:
        elapsed = time.time() - start_time

        # Explicit, self-documenting mapping from layout keys to widgets/strings
        # Uses frame.area() dynamically to adapt to any terminal window size
        terminal.draw(
            lambda frame: layout.map(
                frame.area(),
                widgets={
                    "header": "  Dashboard Header",
                    "body": Block(borders="all", title=f" Main Content - {elapsed:.2f}s "),
                    "footer": "  Status: Active"
                }
            )
        )
        time.sleep(0.016)  # ~60 FPS

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

xnano-0.99.2.tar.gz (70.2 kB view details)

Uploaded Source

Built Distribution

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

xnano-0.99.2-cp310-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file xnano-0.99.2.tar.gz.

File metadata

  • Download URL: xnano-0.99.2.tar.gz
  • Upload date:
  • Size: 70.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xnano-0.99.2.tar.gz
Algorithm Hash digest
SHA256 3fc235d2c8c30398de83a458fdd9a919379f93f948ee2d6bc4da1456ae7429d7
MD5 5643f1b454dd30fa3c5e5941eb6ea86a
BLAKE2b-256 1f9f18241c9c88120ac65049d3311106f999cc322cd210eb06e80ea467fba7c2

See more details on using hashes here.

File details

Details for the file xnano-0.99.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: xnano-0.99.2-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xnano-0.99.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bcb5fd34d1f68bc21c7cc09d2efc5d66a1dbea11287e9b2b007b55c0d7cb1594
MD5 68c3792327a05af66e27932aa663161c
BLAKE2b-256 86db3c372ede096ec5df71e927cd94bbf5be6fd4bda3e09146197ec9a1006fe0

See more details on using hashes here.

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