Skip to main content

gpui-toolkit

PyPI version Python versions License: ISC

Build native desktop apps, charts, and 3D scenes in pure Python — rendered on the GPU by GPUI (the UI framework behind Zed).

You declare the UI in Python. A native host binary bundled in the wheel renders it in a real OS window: Metal on macOS, DirectX 12/Vulkan on Windows, Vulkan on Linux. No Rust toolchain, no Electron, no browser, no HTML.

  • Declarative UI — layout, widgets, sidebars, themes, mini-app shell.
  • Charts — Plotly-Express-style builders (px.line, px.scatter, px.heatmap, …) over typed datasets, with zoom/pan/selection in the host.
  • 2D & 3D scenes — retained 3D surfaces, meshes and line orbits (scene3d), plus a 2D drawing surface with pointer/keyboard input (scene2d) suitable for boards and small games.
  • Fast native core — statistics, ticks, color scales and interpolation from the Rust gpui-d3rs crate, exposed through a private abi3 extension and typed stubs (py.typed).
  • Zero runtime dependencies for the base wheel.

Install

Python 3.10 or newer:

pip install gpui-toolkit

Each platform wheel bundles its own native host, so that one command is the whole setup. Verify the install (second command prints the bundled host path — if it prints one, windowing will work):

python -c "import gpui_toolkit; print(gpui_toolkit.__version__)"
python -c "from gpui_toolkit.app import _host_binary; print(_host_binary())"
Platform Wheels
macOS arm64, x86_64
Windows x64
Linux x86_64 (manylinux, glibc 2.39+)

Optional: richer Arrow conversion for nested or temporal dataset columns:

pip install 'gpui-toolkit[arrow]'

Quickstart

Step 1 — your first window

Save as hello.py and run python hello.py. A native window opens with a sidebar ("Home") and the content below:

from gpui_toolkit import App, section, ui

app = App(
    title="Hello GPUI",
    sections=[
        section(
            "home",
            "Home",
            ui.vstack(
                [
                    ui.section_header(
                        "Hello from Python",
                        "Declared in Python, rendered natively by GPUI.",
                    ),
                    ui.text("No Rust, no browser, no HTML — a real native window."),
                ],
                gap=12.0,
            ),
        )
    ],
)

if __name__ == "__main__":
    app.run()

An App is the whole window. It needs at least one section(id, label, content); each section becomes a sidebar entry. ui.vstack / ui.hstack lay out widgets — text, metrics, buttons, cards, selects, sliders, and more.

Step 2 — add a chart

Charts bind to a Dataset (column data the host owns). Declare every dataset a chart uses in resources=, otherwise the host has nothing to bind:

import math

from gpui_toolkit import App, data, px, section, ui

xs = [float(i) for i in range(72)]
wave = data.Dataset.from_mapping(
    {
        "x": xs + xs,
        "y": [math.sin(x * 0.35) for x in xs] + [math.cos(x * 0.35) for x in xs],
        "series": ["Sine"] * len(xs) + ["Cosine"] * len(xs),
    },
    id="wave",
)

chart = (
    px.line("wave-chart")
    .data(wave)
    .x("x")
    .y("y")
    .series("series")
    .title("Waveforms")
    .x_label("Sample")
    .y_label("Amplitude")
)

app = App(
    title="Hello GPUI",
    sections=[
        section(
            "home",
            "Home",
            ui.vstack(
                [
                    ui.section_header(
                        "Hello from Python",
                        "Declared in Python, rendered natively by GPUI.",
                    ),
                    ui.text("No Rust, no browser, no HTML — a real native window."),
                ],
                gap=12.0,
            ),
        ),
        section("chart", "Chart", chart),
    ],
    resources=(wave,),  # every Dataset a chart binds must be declared here
)

if __name__ == "__main__":
    app.run()

Swap px.line for px.scatter, px.area, px.bar, px.boxplot, px.pie, px.donut, px.heatmap, px.contour, px.isoline, or px.treemap — same builder shape.

Step 3 — handle clicks

Widgets send actions; your on_action replies with patches. Subclass App as a dataclass to keep state:

from dataclasses import dataclass

from gpui_toolkit import App, Event, SessionContext, section, ui


@dataclass
class CounterApp(App):
    clicks: int = 0

    def on_action(self, event: Event, context: SessionContext) -> None:
        if event.action != "bump":
            return
        self.clicks += 1
        context.acknowledge(event)
        context.patch(
            [
                {
                    "op": "set",
                    "id": "clicks",
                    "property": "value",
                    "value": str(self.clicks),
                }
            ],
            request_id=event.id,
        )


app = CounterApp(
    title="Counter",
    sections=[
        section(
            "home",
            "Home",
            ui.vstack(
                [
                    ui.metric("Clicks", 0, id="clicks"),
                    ui.button("Click me", id="bump-button", action="bump"),
                ],
                gap=12.0,
            ),
        )
    ],
)

if __name__ == "__main__":
    app.run()

The loop is always the same: native event → on_action (match on event.action) → context.patch(...) updates widgets by their stable id. Input controls (sliders, selects, text inputs) carry their new value in event.payload. Note that patched values must match the widget schema — a metric's value is a string, hence str(self.clicks).

Step 4 — iterate headlessly

Check the UI spec without opening a window — this prints the exact JSON your script hands to the host, which is handy for debugging and CI:

GPUI_TOOLKIT_DUMP_IR=1 python hello.py

How it works

Python builds a JSON UI description ("IR"); App.run() launches the bundled Rust host, which owns the window, GPUI rendering, themes, and GPU state. Dataset and array payloads travel as Arrow IPC / memory-mapped frames (never inside the JSON), and user input comes back as typed events. Your process stays pure Python — the host is a renderer, not an interpreter you have to embed.

What's in the box

Module What it does
gpui_toolkit.ui Layout (vstack, hstack, cards) and widgets (button, metric, select, slider, text input, progress, badges…)
gpui_toolkit.px Chart builders: line, scatter, area, bar, boxplot, pie, donut, heatmap, contour, isoline, treemap
gpui_toolkit.data Dataset / ArrayData resources, views, filters, group-by aggregation
gpui_toolkit.scene3d Retained 3D: surfaces, meshes, line orbits, cameras, colormaps
gpui_toolkit.scene2d 2D drawing surface (rects, circles, paths, gradients) with pointer/keyboard input and ticks
gpui_toolkit.meshplot Unstructured triangle-mesh plots with scalar fields
gpui_toolkit.miniapp Native mini-app shell: window chrome + theme switcher
gpui_toolkit.d3rs, gpui_toolkit.native D3-style scales, ticks, statistics, color interpolation — Rust-backed

Examples

Full apps in the repository, each runnable against the installed wheel:

Example Shows
Tutorial demo_app.py Start here: metrics, theme picker, two charts, live patch loop
chart_gallery.py Every px chart type
spinorama_demo.py CEA2034 speaker measurements: SPL charts, contour, 3D surface
surface3d_demo.py 3D surface modes with orbit camera
games_demo.py Scene2D boards: Sudoku, Chess, Tetris, Othello, Queens, Zip
showcase.py The full component catalog, background jobs, live patching

Documentation

  • Python tutorial — the step-by-step walkthrough this page abbreviates: install, run, how demo_app.py fits together, the action loop in depth, troubleshooting.
  • Toolkit tutorial, §12 Python Runtime Demo — the same Python path in the wider toolkit tour (scaffolding, themes, design system, building and distributing apps).
  • Examples directory — every demo above, plus mesh-plot variants.
  • Repository README — the full Rust workspace this package is part of.
  • Changelog.
  • Contributing or hacking on the runtime itself? The crate README documents the IR/schema contracts, resource model, and dev tooling.

Troubleshooting

Symptom Cause / fix
No GPUI native host was found Wheel installed without its bundled binary. pip install --force-reinstall gpui-toolkit, or point GPUI_TOOLKIT_HOST at a host binary.
ImportError on gpui_toolkit inside the window The host spawned a different interpreter than the one holding the wheel. Set GPUI_PYTHON=$(which python).
App requires at least one section App(sections=[]) — add at least one section(...).
Button does nothing The button's action must match event.action in on_action, and the patched id must exist in the spec.
Chart is empty Its Dataset/ArrayData is missing from app.resources, so the host has nothing to bind.

Status

Alpha (0.x): the Python API and the v1 JSON schema are usable today and versioned — additive fields stay on v1, breaking shape changes require a schema bump with a migration path. The package version tracks the Rust workspace version. Issues and questions: github.com/pierreaubert/gpui-toolkit/issues.

License

ISC — see LICENSE.

Metadata

Release files for gpui-toolkit 0.11.1

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

Built distributions (wheels)

Table of built distributions (wheels) for gpui-toolkit 0.11.1
File Actions
gpui_toolkit-0.11.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for gpui_toolkit-0.11.1-py3-none-win_amd64.whl
gpui_toolkit-0.11.1-py3-none-manylinux_2_39_x86_64.whl Python 3 none Linux glibc 2.39+ x86-64 Details for gpui_toolkit-0.11.1-py3-none-manylinux_2_39_x86_64.whl
gpui_toolkit-0.11.1-py3-none-macosx_15_0_arm64.whl Python 3 none macOS 15.0+ ARM64 Details for gpui_toolkit-0.11.1-py3-none-macosx_15_0_arm64.whl
gpui_toolkit-0.11.1-py3-none-macosx_10_13_x86_64.whl Python 3 none macOS 10.13+ x86-64 Details for gpui_toolkit-0.11.1-py3-none-macosx_10_13_x86_64.whl
gpui_toolkit-0.11.1-py3-none-any.whl Python 3 none any Details for gpui_toolkit-0.11.1-py3-none-any.whl

Total release size: 108.3 MB

Release files / gpui_toolkit-0.11.1-py3-none-win_amd64.whl

Download URL gpui_toolkit-0.11.1-py3-none-win_amd64.whl
Size 32.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d878c56a085d898b24464cba84f5b397c50d44c6ed53e857442bb27da3bbfcb1
BLAKE2b-256 checksum
How to use checksums
313f4a3a02982dd923d7e4004bd7269610dc8f2000ec76f99d95103f6e0c2083
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Release files / gpui_toolkit-0.11.1-py3-none-manylinux_2_39_x86_64.whl

Download URL gpui_toolkit-0.11.1-py3-none-manylinux_2_39_x86_64.whl
Size 26.1 MB
Tags Linux glibc 2.39+ x86-64 Python 3
SHA-256 checksum
How to use checksums
3b9dc99a39f90c2fd78f4ddc881ce7a9ebab73da63c2ea82eb61f77864f479d4
BLAKE2b-256 checksum
How to use checksums
fe9982667ddaefeab598cfaad79d1b987930233b31a98c15d10e61106fb58c24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Release files / gpui_toolkit-0.11.1-py3-none-macosx_15_0_arm64.whl

Download URL gpui_toolkit-0.11.1-py3-none-macosx_15_0_arm64.whl
Size 17.8 MB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
2ae28d9b5b6321a4553d4324e28dd5853b1620cf15bf3056ad7efeb3ff63f57a
BLAKE2b-256 checksum
How to use checksums
3777814d37a54b337ee8c83f936e1cc4e455da2c349853804176a10b7f7ff511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Release files / gpui_toolkit-0.11.1-py3-none-macosx_10_13_x86_64.whl

Download URL gpui_toolkit-0.11.1-py3-none-macosx_10_13_x86_64.whl
Size 18.7 MB
Tags Python 3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
8872299f7acab4f74cfea70a45fb6c10262a0b0a2e5de20dc716af0a3b85ae82
BLAKE2b-256 checksum
How to use checksums
91f6fb62905353de99d20ec61a411b358a0430470ac0fb3682ee780f60cdb6f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Release files / gpui_toolkit-0.11.1-py3-none-any.whl

Download URL gpui_toolkit-0.11.1-py3-none-any.whl
Size 13.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
94d1571578a2cdfd36e36e09caee7cf731cec02a0c649f9b7951b88d196007a4
BLAKE2b-256 checksum
How to use checksums
df053e08ef43cd6e16db0872eb669802bf1871d94131616059153214d453d9bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Security for gpui-toolkit 0.11.1

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for gpui_toolkit-0.11.1-py3-none-win_amd64.whl

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 Nov 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.1 This release

5 release files Full provenance

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