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.3.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.3-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.3.tar.gz.

File metadata

  • Download URL: xnano-0.99.3.tar.gz
  • Upload date:
  • Size: 70.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","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.3.tar.gz
Algorithm Hash digest
SHA256 4466729db30577c2741d03ec32d4a3f27883db6de2fdb4a10099ecb815c5a1c0
MD5 edc7eb3d7932b36f18215a9b3898fde5
BLAKE2b-256 15cec46faf3a90dd8dc3eecbc43ac5923cc342e4a9fd9197a832788e29f3f2d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xnano-0.99.3-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.20 {"installer":{"name":"uv","version":"0.11.20","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.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4b62f72022e68232bf46e612451acbd7407615d132022320fb367148cad2012
MD5 b0b69372aa0836596cc7782312e038ee
BLAKE2b-256 13c910b262e83f611ca0515b8e97dbc4c02a73fe8eeeb43d9945648e87bf3573

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