๐๐ 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 ๐โก๐ฅ
โจ๐๐ซ Maturin-based Python bindings for ratatui 0.29 ๐ฆ๐๐ฅ
๐๐๐ Partnered with: Alacritty ๐ฅโกโจ
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 โ
AsyncTerminalintegrates 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
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c92321cc5531b423959690be61c1e820c39dc7502a4491778d4e8459f68c8e99
|
|
| MD5 |
8b9ea06ff3b2e2768bc9eb7f108ef8f6
|
|
| BLAKE2b-256 |
ce738c4fd56ae0aea2b2bfc75b4c1e29bb84ec50b91d69cc36587e0155ef3aba
|
Provenance
The following attestation bundles were made for pyratatui-0.1.1-cp310-abi3-win_amd64.whl:
Publisher:
ci.yml on pyratatui/pyratatui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyratatui-0.1.1-cp310-abi3-win_amd64.whl -
Subject digest:
c92321cc5531b423959690be61c1e820c39dc7502a4491778d4e8459f68c8e99 - Sigstore transparency entry: 1036845663
- Sigstore integration time:
-
Permalink:
pyratatui/pyratatui@c492840ff67e389fed1e6cb0914098fe93cdad5a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pyratatui
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c492840ff67e389fed1e6cb0914098fe93cdad5a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyratatui-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pyratatui-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 823.9 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8083726663f5967763c8d7086b60ed53a6d281e903e79c06afe073b830893a3d
|
|
| MD5 |
5e5a76126385428b64c0cddd3c42916a
|
|
| BLAKE2b-256 |
2707599040f0dc9fb2e042d5013bf0ed2d85a9df63147a8f2ad1ff2d99d850e3
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyratatui-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
8083726663f5967763c8d7086b60ed53a6d281e903e79c06afe073b830893a3d - Sigstore transparency entry: 1036845727
- Sigstore integration time:
-
Permalink:
pyratatui/pyratatui@c492840ff67e389fed1e6cb0914098fe93cdad5a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pyratatui
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c492840ff67e389fed1e6cb0914098fe93cdad5a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyratatui-0.1.1-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyratatui-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 758.1 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e60cd852fdaeea0cab338a7ae6eba202b6204855e76ef5c9c2989c011dfef6a
|
|
| MD5 |
5dfc459f8494f9611e76db7f8fe30b7f
|
|
| BLAKE2b-256 |
8fe483a4a78116cad92b5af6891d5015b60a919fc4ab588a62e410713b71257b
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyratatui-0.1.1-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
0e60cd852fdaeea0cab338a7ae6eba202b6204855e76ef5c9c2989c011dfef6a - Sigstore transparency entry: 1036845797
- Sigstore integration time:
-
Permalink:
pyratatui/pyratatui@c492840ff67e389fed1e6cb0914098fe93cdad5a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pyratatui
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c492840ff67e389fed1e6cb0914098fe93cdad5a -
Trigger Event:
workflow_dispatch
-
Statement type: