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](https://ratatui.rs)`` and ``[tachyonfx](https://github.com/ratatui/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.


Examples

Agent Chat

View Example

Agent Chat Example

Dashboard

View Example

Dashboard Example

Effects Demo

View Example

Effects Demo Example

Tab Navigation

View Example

Tab Navigation 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.1.tar.gz (69.7 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.1-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.1.tar.gz.

File metadata

  • Download URL: xnano-0.99.1.tar.gz
  • Upload date:
  • Size: 69.7 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.1.tar.gz
Algorithm Hash digest
SHA256 a5f88fce39a1b5d0e5fb73786232d82a8c081c13083cc0ecadd0bc4a1bec8516
MD5 bd2f7eee9a750d2f47b49aedfb8238b6
BLAKE2b-256 050e9f7c49afb9c49c159398d1eb78786e4b0c68a08d4c82d339df38cbfe40cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xnano-0.99.1-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.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f9d57b9f49fda674da09dea592e67bd3b12c8ccadfd96a9bbd9ca372816d5ab
MD5 bb9456e08ff2381b70461fced3ddface
BLAKE2b-256 e3210232279287aca05bdf2fafe360854d9f7bd86536d6893f2b1f42b675e094

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