PyRatatui – Python bindings for the Ratatui terminal UI library

Hi HN,

I’ve been working on PyRatatui, a Python binding for the Rust terminal UI framework Ratatui.

Ratatui provides a rich set of widgets and layout primitives for building terminal applications such as dashboards, monitoring tools, developer utilities, and interactive CLI programs. PyRatatui exposes this functionality to Python using PyO3 so applications can be written in Python while the rendering and layout engine runs in Rust.

The goal is to combine Python’s developer ergonomics with the performance and UI capabilities of Ratatui.

Example:

from pyratatui import Terminal, Paragraph, Block, Style, Color

with Terminal() as term: while True: def ui(frame): frame.render_widget( Paragraph.from_string("Hello from PyRatatui. Press q to quit.") .block(Block().bordered().title("Hello World")) .style(Style().fg(Color.cyan())), frame.area, ) term.draw(ui) ev = term.poll_event(timeout_ms=100) if ev and ev.code == "q": break

Current features include:

• Python bindings to Ratatui widgets such as Paragraph, Block, Tables, Charts, and Scrollbars • event handling for keyboard input • type hints for IDE support • Rust ↔ Python integration using PyO3

The project is still evolving and feedback from people who build terminal tools would be very helpful.

Repository: https://github.com/pyratatui/pyratatui

1 points | by programmersd 3 hours ago

1 comments

  • programmersd 3 hours ago
    Author here. Happy to answer questions about the Rust ↔ Python bridge or the design of the bindings.