Skip to main content

pyratatui banner

pyratatui

Python bindings for Ratatui, implemented in Rust with PyO3.

Version 0.3.0 targets Ratatui 0.30.2 and supports Python 3.10+.

Installation

pip install pyratatui

Building from source requires Rust 1.88 or newer and maturin:

pip install maturin
maturin develop --release

Example

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


def ui(frame):
    frame.render_widget(
        Paragraph.from_string("Hello! Press q to quit.")
        .block(Block().bordered().title("Hello"))
        .style(Style().fg(Color.cyan())),
        frame.area,
    )


run_app(ui, on_key=lambda ev: ev.code == "q")

More examples live in examples/. Each one is a small runnable program:

python examples/hello_world.py
python examples/dashboard.py

Patterns

term.draw takes a callback that receives the frame. Snapshot loop state into default arguments so each frame renders its own tick:

with Terminal() as term:
    while True:
        count = state["count"]
        term.draw(lambda frame, _count=count: render(frame, _count))
        ev = term.poll_event(timeout_ms=100)
        if ev and ev.code == "q":
            break

Quitting is always explicit — run_app stops when on_key returns True, and manual loops break on whatever key they choose.

API

The public API is exported from the top-level package:

from pyratatui import (
    Terminal,  # terminal driver (also AsyncTerminal, run_app, run_app_async)
    Frame,  # render surface handed to the draw callback
    KeyEvent,  # keyboard events from poll_event
    Layout,
    Constraint,
    Direction,
    Alignment,
    Rect,
    Style,
    Color,
    Modifier,
    Span,
    Line,
    Text,
    Block,
    Paragraph,
    List,
    Table,
    Gauge,
    BarChart,
    Sparkline,
    Scrollbar,
    Tabs,
    Clear,
    Chart,
    Canvas,
    Map,
    Monthly,
    TextPrompt,
    TextState,
    prompt_text,  # input helpers
    Buffer,  # off-screen surface (testing)
)

Widgets are Ratatui's built-in set plus thin Chart, Canvas, Map, and calendar (Monthly) bindings. Types carry docstrings, and python/pyratatui/_pyratatui.pyi ships full type annotations.

Development

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
maturin develop

pytest            # Python tests (includes pty-based terminal tests)
cargo test        # Rust tests
cargo clippy --all-targets -- -D warnings
cargo fmt --all -- --check
ruff check . && ruff format --check .

See CONTRIBUTING.md for details.

License

MIT — see LICENSE.

Metadata

Release files for pyratatui 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyratatui 0.3.0
File Size Uploaded
pyratatui-0.3.0.tar.gz 84.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyratatui 0.3.0
File
pyratatui-0.3.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
pyratatui-0.3.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
pyratatui-0.3.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
pyratatui-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
pyratatui-0.3.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
pyratatui-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 4.8 MB

Release files / pyratatui-0.3.0.tar.gz

Download URL pyratatui-0.3.0.tar.gz
Size 84.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6ac8f98f041a1b8e06bb56065fc9aeb3904941ff830a0ba9bf7a512ae9981d95
BLAKE2b-256 checksum
How to use checksums
f88917efc06e6e137051ce46cf0a67bf1842d112fd14f5ab3e310f6f57d5cc8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / pyratatui-0.3.0-cp310-abi3-win_amd64.whl

Download URL pyratatui-0.3.0-cp310-abi3-win_amd64.whl
Size 662.3 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9d8496ad7dd0c73cab67cccf7535c1d3bea1300aef16beae69a1ec1598c9d84b
BLAKE2b-256 checksum
How to use checksums
3175e0ba42f28d3d36f3f72da160dd9c5d21e1d5a5db06acbf055abfc3a06c49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / pyratatui-0.3.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL pyratatui-0.3.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 958.2 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
a8240ae0bae0720ca8598023886000f72d48e4c395d01a9ac923f192555badfc
BLAKE2b-256 checksum
How to use checksums
bf1fa9b0814992090771fb61bc504066b16285c788faceb151b5ae0f952edd72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / pyratatui-0.3.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL pyratatui-0.3.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 893.3 kB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
316f15d7428d60f88dcf8de7b403ca40e09912500d299dc3ed80fa2d28ff0728
BLAKE2b-256 checksum
How to use checksums
f01037c21aada277b103275156390e5ed5601cf42f5a89fa70f7c112c0929827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / pyratatui-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyratatui-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 748.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
dae567c33161606b6d82a0c8755994778ac834e4288a58959af651e04b7acfe0
BLAKE2b-256 checksum
How to use checksums
23ae9e834682fed6d095984ad6258ec186da6be6ce5553795adbced77848dc38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / pyratatui-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL pyratatui-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Size 695.1 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8ff37d261faef28402216701dd9a8acdc47baad2fcd219db04ae398af0eb60ac
BLAKE2b-256 checksum
How to use checksums
cb88e2c11b8e2f7b22c070f15f810ba86e4e52dbca2fe0c045497a67b282fe77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / pyratatui-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL pyratatui-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 735.9 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
192636d9e9391987b1a4121d7d0c207f33e338d16f6cdeddf83f49eeb5908f73
BLAKE2b-256 checksum
How to use checksums
7dd32fc9766bdba80c3593cc4a2cbc136a07e895a431f07a52f40d85dc06fe28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

7 release files

0.2.9

7 release files

0.2.8

7 release files

0.2.7

7 release files

0.2.6

7 release files

0.2.5

7 release files

0.2.4

7 release files

0.2.3

7 release files

0.2.2

5 release files

0.2.1

4 release files

0.2.0

4 release files

0.1.2

3 release files

0.1.1

3 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page