xnano
A simple python tui framework built on top of the ratatui and tachyonfx rust libraries.
[!NOTE] Documentation with examples that are runnable & editable in-browser are now available at https://xnano.hammad.app!
xnano is a modern, lightweight and incredibly declarative TUI framework for Python. It is built on top of the xnano-core rust library, which provides the core rendering and event handling capabilities through:
- ratatui A Rust library for building terminal user interfaces.
- tachyonfx Rust library for adding effects and animations to ratatui applications.
Furthermore, xnano itself uses the pydantic-core library for type validation and similar operations.
Installation
pip install "xnano>=1.2.1"Or use uv:
uv add "xnano>=1.2.1"[!TIP] Try running the python -m xnano or uv run xnano commands to test out the built in demo application. bash uv run xnano
---
Examples
You can view the code for these examples here: examples.
Your first render
The easiest way to get started is the print-like render() helper — no session, no event loop. It writes styled content to the terminal and returns.
from xnano import render
from xnano.components.text import Text
render(
Text("Hello from xnano!", foreground="violet", modifiers=["bold"])
)You can pass multiple renderables — they stack vertically: