Skip to main content

๐Ÿš€๐Ÿ€ PyRatatui โ€” Professional Python bindings for ratatui 0.29 ๐Ÿฆ€๐Ÿคฉ | ๐Ÿ’ฅ๐Ÿ”ฅ High-performance Rust TUI engine for building rich terminal applications, interactive CLIs, dashboards, and text-based UIs ๐Ÿ’ฏโœจ

Project description

๐ŸŒŸ๐Ÿš€๐Ÿ’Ž pyratatui ๐Ÿโšก๐Ÿ”ฅ


PyRatatui Logo


โœจ๐Ÿš€๐Ÿ’ซ Maturin-based Python bindings for ratatui 0.29 ๐Ÿฆ€๐ŸŒˆ๐Ÿ”ฅ


Demo


๐Ÿ’–๐ŸŒŸ๐ŸŒˆ Partnered with: Alacritty ๐Ÿ”ฅโšกโœจ

Alacritty


CI
PyPI
Python
License

pyratatui bridges Rust's ultra-fast terminal rendering engine ๐Ÿฆ€๐Ÿ’จ with Python's ergonomic and productive ecosystem ๐Ÿ๐Ÿ’ก๐Ÿ’Ž.

  • Native Rust rendering via ratatui 0.29 โšก๐Ÿš€
  • Fully Pythonic API โ€” fluent builders, snake_case, type stubs ๐Ÿโœจ
  • Async-ready โ€” AsyncTerminal integrates seamlessly with asyncio โšก๐Ÿ’ป
  • Zero Rustisms in Python API โœ…
  • ABI3 wheels โ€” one wheel per OS/arch, Python 3.10โ€“3.13+ ๐Ÿ’Ž๐ŸŒŸ

Installation ๐Ÿ’พ๐Ÿ› ๏ธ

pip install pyratatui ๐Ÿ”ฅ

Build from source (requires Rust stable + maturin ๐Ÿฆ€):

pip install maturin
maturin develop --release ๐Ÿš€

Hello World ๐Ÿ‘‹๐Ÿ€โœจ

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

with Terminal() as term:
    while True:
        def ui(frame):
            frame.render_widget(
                Paragraph.from_string("Hello, pyratatui! ๐Ÿ€๐Ÿ’–")
                    .block(Block().bordered().title("Demo ๐Ÿš€โœจ"))
                    .style(Style().fg(Color.cyan())),
                frame.area,
            )
        term.draw(ui)
        ev = term.poll_event(timeout_ms=100)
        if ev and ev.code == "q":
            break ๐Ÿ›‘

Layout & Widgets ๐Ÿ“Š๐Ÿ–Œ๏ธ๐Ÿ’Ž

from pyratatui import (
    Terminal, Layout, Constraint, Direction,
    Block, Paragraph, Gauge, List, ListItem, ListState,
    Table, Row, Cell, TableState,
    Style, Color,
)

with Terminal() as term:
    list_state = ListState()
    list_state.select(0)
    table_state = TableState()
    table_state.select(0)

    while True:
        def ui(frame):
            chunks = Layout().direction(Direction.Vertical).constraints([
                Constraint.length(3),
                Constraint.fill(1),
                Constraint.length(3),
            ]).split(frame.area)

            frame.render_widget(Block().bordered().title("pyratatui Dashboard ๐Ÿ“Š๐Ÿ’ก"), chunks[0])

            body = Layout().direction(Direction.Horizontal).constraints([
                Constraint.percentage(40), Constraint.fill(1)
            ]).split(chunks[1])

            items = [ListItem(f"Server {i+1} โšก๐Ÿ’ป") for i in range(8)]
            frame.render_stateful_list(
                List(items)
                    .block(Block().bordered().title("Servers ๐Ÿ–ฅ๏ธ๐ŸŒŸ"))
                    .highlight_style(Style().fg(Color.yellow()).bold())
                    .highlight_symbol("โ–ถโœจ"),
                body[0],
                list_state,
            )

            header = Row([Cell("Name ๐Ÿท๏ธ"), Cell("CPU ๐Ÿ’ป"), Cell("Mem ๐Ÿง ")])
            rows = [Row.from_strings(["nginx โšก", "0.2% ๐Ÿ”น", "128MB ๐Ÿ’พ"]),
                    Row.from_strings(["redis โšก", "0.1% ๐Ÿ”น", "64MB ๐Ÿ’พ"])]
            frame.render_stateful_table(
                Table(rows, [Constraint.fill(1)]*3, header=header)
                    .block(Block().bordered().title("Processes ๐Ÿงฎ๐Ÿ’Ž"))
                    .highlight_style(Style().fg(Color.cyan())),
                body[1],
                table_state,
            )

            frame.render_widget(
                Gauge().percent(72).label("CPU: 72% ๐Ÿ’šโšก")
                    .style(Style().fg(Color.green()))
                    .block(Block().bordered()),
                chunks[2],
            )

        term.draw(ui)
        ev = term.poll_event(timeout_ms=50)
        if ev:
            if ev.code == "q": break
            elif ev.code == "Down": list_state.select_next()
            elif ev.code == "Up": list_state.select_previous()

Async Usage โšก๐Ÿ’ป๐Ÿš€

import asyncio
from pyratatui import AsyncTerminal, Paragraph, Block, Style, Color

async def main():
    tick = 0
    async with AsyncTerminal() as term:
        async for ev in term.events(fps=30):
            def ui(frame, t=tick):
                frame.render_widget(
                    Paragraph.from_string(f"Tick: {t} โฑ๏ธโœจ")
                        .block(Block().bordered().title("Async ๐Ÿš€๐Ÿ’ก"))
                        .style(Style().fg(Color.magenta())),
                    frame.area,
                )
            term.draw(ui)
            tick += 1

asyncio.run(main())

API Overview ๐Ÿ“š๐Ÿ› ๏ธโœจ

Module Types
style Color, Modifier, Style ๐Ÿ–Œ๏ธ๐Ÿ’Ž
text Span, Line, Text โœ๏ธโœจ
layout Rect, Constraint, Direction, Alignment, Layout ๐Ÿงฉ๐Ÿ’ก
buffer Buffer ๐Ÿ”นโšก
widgets Block, Paragraph, List, Table, Gauge, LineGauge, ... ๐Ÿ› ๏ธ๐Ÿš€
terminal Terminal, Frame, KeyEvent ๐ŸŽ›๏ธ๐Ÿ’Ž
async AsyncTerminal, run_app, run_app_async โšก๐Ÿ’ป
errors PyratatuiError, BackendError, LayoutError, RenderError, ... โŒ๐Ÿ”ฅ

Full reference: https://pyratatui.github.io/pyratatui


Contributing ๐Ÿคโœจ๐Ÿ’ก

git clone https://github.com/pyratatui/pyratatui.git
cd pyratatui
python -m venv .venv && source .venv/bin/activate
pip install maturin pytest pytest-asyncio ruff mypy
maturin develop
pytest tests/python/
cargo test ๐Ÿš€

License ๐Ÿ“œ๐Ÿ’Ž

MIT โ€” see LICENSE

Built with ratatui ๐Ÿ€๐Ÿ’จ and PyO3 ๐Ÿฆ€โšก


Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pyratatui-0.1.1-cp310-abi3-win_amd64.whl (747.5 kB view details)

Uploaded CPython 3.10+Windows x86-64

pyratatui-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (823.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

pyratatui-0.1.1-cp310-abi3-macosx_11_0_arm64.whl (758.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file pyratatui-0.1.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: pyratatui-0.1.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 747.5 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyratatui-0.1.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c92321cc5531b423959690be61c1e820c39dc7502a4491778d4e8459f68c8e99
MD5 8b9ea06ff3b2e2768bc9eb7f108ef8f6
BLAKE2b-256 ce738c4fd56ae0aea2b2bfc75b4c1e29bb84ec50b91d69cc36587e0155ef3aba

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyratatui-0.1.1-cp310-abi3-win_amd64.whl:

Publisher: ci.yml on pyratatui/pyratatui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyratatui-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyratatui-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8083726663f5967763c8d7086b60ed53a6d281e903e79c06afe073b830893a3d
MD5 5e5a76126385428b64c0cddd3c42916a
BLAKE2b-256 2707599040f0dc9fb2e042d5013bf0ed2d85a9df63147a8f2ad1ff2d99d850e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyratatui-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci.yml on pyratatui/pyratatui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyratatui-0.1.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyratatui-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e60cd852fdaeea0cab338a7ae6eba202b6204855e76ef5c9c2989c011dfef6a
MD5 5dfc459f8494f9611e76db7f8fe30b7f
BLAKE2b-256 8fe483a4a78116cad92b5af6891d5015b60a919fc4ab588a62e410713b71257b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyratatui-0.1.1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: ci.yml on pyratatui/pyratatui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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