gpui-python-runtime
Retained scene specifications for the GPUI Python wrapper.
Python declares UI and scene3d objects. Rust validates the scene, tracks
stable ids, classifies dirty resources, and adapts supported nodes to
gpui-d3rs 3D elements. Raw wgpu devices, queues, buffers, pipelines, and
shaders remain private to the renderer.
V1 Scene3D Scope
- Surfaces: row-major
zgrids with optionalx/yaxes, log axes, z range, labels, colormaps, wireframe mode, orbit cameras, and interactions. - Lines: retained orbit camera state and CPU-projected
Lines3DElementsegments/line strips. - Meshes, materials, perspective cameras, and lights: validated spec objects for the lower-level scene API. Mesh rendering is intentionally not bound to a GPUI element yet.
JSON Schema Contract
Python-authored payloads are versioned at the JSON boundary:
- app IR uses
schema_version: 1, exposed asPYTHON_APP_IR_SCHEMA_VERSION. - Scene3D specs use
schema_version: 1, exposed asSCENE3D_SPEC_SCHEMA_VERSION.
New Python emitters write the current schema version. Rust treats omitted
schema_version fields as v1 so early examples and local scripts keep loading,
but validation rejects unsupported future versions before rendering or reusing a
cached spec.
Compatibility policy:
- Additive optional fields may stay on v1 when Rust gives them safe defaults.
- Renaming fields, removing fields, changing data-shape semantics, or changing renderer meaning requires a schema-version bump.
- A schema-version bump must include compatibility tests for previous v1 payloads and a migration path before Python emitters start writing it.
- Consumers should parse JSON, validate
PythonAppIr, then parse and validate Scene3D specs throughTypedSpecCacheorvalidate_scene3d_spec_schema_version.
Resource Model
RetainedSceneCache fingerprints geometry, material, and camera state
separately:
- unchanged scenes do no renderer work,
- camera-only changes update uniforms/state,
- color/material changes update small renderer state,
- data/mesh changes reupload affected geometry.
Gpui3DCache is available behind the gpui feature and keeps
Surface3DElement / line camera state keyed by stable ids.
Python Examples
The examples build JSON-serializable scene specs that the Rust runtime can validate and adapt to GPUI elements:
PYTHONPATH=python python examples/surface_dispersion.py
PYTHONPATH=python python examples/lines_orbit.py
PYTHONPATH=python python examples/mesh_scene.py
surface_dispersion.pyshows a log-frequency surface with orbit controls.lines_orbit.pyshows line strips, axis references, and a shared orbit camera.mesh_scene.pyshows the future lower-level scene shape with mesh, path, and light nodes.
The larger app-authored demos mirror the Rust showcase programs:
# Dump the native app IR without requiring a GPUI host.
GPUI_TOOLKIT_DUMP_IR=1 PYTHONPATH=python python examples/spinorama_demo.py
GPUI_TOOLKIT_DUMP_IR=1 PYTHONPATH=python python examples/surface3d_demo.py
GPUI_TOOLKIT_DUMP_IR=1 PYTHONPATH=python python examples/chart_gallery.py
# Without a host-related environment variable, each script prints JSON too.
PYTHONPATH=python python examples/spinorama_demo.py > /tmp/spinorama-python.json
spinorama_demo.pycontains CEA2034, horizontal SPL, vertical SPL, contour, and retained 3D surface sections using deterministic local data.surface3d_demo.pycontains the sinc, spinorama-style, and saddle surface modes from the Rustsurface3d_demo.chart_gallery.pycovers scatter, line, area, heatmap, contour, isoline, bar, pie, donut, box-plot, and treemap declarations.
Replace the local data-builder functions with measurement or application data when adapting a demo; the chart and Scene3D declarations remain unchanged.
Python Package
The Python declarations are packaged as gpui-toolkit with the import package
gpui_toolkit. The package is pure Python and intentionally has no runtime
dependencies; Rust/GPUI remains the rendering host.
python -m pip install gpui-toolkit
python -c "import gpui_toolkit; print(gpui_toolkit.__version__)"
The package version matches the Rust crate version. Update both
pyproject.toml and Cargo.toml together when releasing a new Python-facing
runtime.
Showcase Application
Run the Python-authored native GPUI showcase with retained 3D scenes and
embedded gpui-px charts:
cargo run -p gpui-python-runtime --features showcase --bin gpui-python-showcase -- crates/gpui-toolkit/gpui-python-runtime/python/showcase.py
PYTHONPATH=crates/gpui-toolkit/gpui-python-runtime/python ./venv/bin/python crates/gpui-toolkit/gpui-python-runtime/python/showcase.py
The showcase app, sections, UI kit demos, chart data, and scene3d specs live
in Python. Rust loads the JSON UI IR, then owns GPUI, retained 3D renderer
state, chart widgets, and theme integration.
Platform Notes
The renderer path is inherited from wgpu via gpui-d3rs:
- macOS/iOS: Metal,
- Linux: Vulkan where available,
- Windows: DirectX 12 or Vulkan depending adapter support,
- Android: Vulkan once a GPUI Android backend exists.
The Python API is intended to stay the same across platforms; only GPUI backend initialization should differ.
Metadata
Release files for gpui-toolkit 0.9.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| gpui_toolkit-0.9.25-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| gpui_toolkit-0.9.25-py3-none-manylinux_2_39_x86_64.whl | Python 3 | none | Linux glibc 2.39+ x86-64 | Details |
| gpui_toolkit-0.9.25-py3-none-macosx_14_0_arm64.whl | Python 3 | none | macOS 14.0+ ARM64 | Details |
| gpui_toolkit-0.9.25-py3-none-macosx_10_13_x86_64.whl | Python 3 | none | macOS 10.13+ x86-64 | Details |
| gpui_toolkit-0.9.25-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.1 MB
Release files / gpui_toolkit-0.9.25-py3-none-win_amd64.whl
| Download URL | gpui_toolkit-0.9.25-py3-none-win_amd64.whl |
|---|---|
| Size | 22.1 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1d25c759e30bacd965f9a3f402b2b302b230a3ed9f48312159a6acc30cc23a66
|
|
BLAKE2b-256 checksum How to use checksums |
537dba40cab6829c118364e3b166cae9cebd86bcac961816dfe74f3f6b20693d
|
| 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 1, 2026.
Transparency logRelease files / gpui_toolkit-0.9.25-py3-none-manylinux_2_39_x86_64.whl
| Download URL | gpui_toolkit-0.9.25-py3-none-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 17.3 MB |
| Tags | Linux glibc 2.39+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
7e2d64aed6850ed355a14097391d4cca5b8aa6cda668f8889702e4f96b372629
|
|
BLAKE2b-256 checksum How to use checksums |
1e956fb57180313f964679512b183cb22cf4e8f540a9d6b523c101f08b0b823c
|
| 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 1, 2026.
Transparency logRelease files / gpui_toolkit-0.9.25-py3-none-macosx_14_0_arm64.whl
| Download URL | gpui_toolkit-0.9.25-py3-none-macosx_14_0_arm64.whl |
|---|---|
| Size | 10.9 MB |
| Tags | Python 3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dab51d2016e7e49b76261734d7d55925431df1acd7a64f6bb608fa3953803c6f
|
|
BLAKE2b-256 checksum How to use checksums |
a0e56c0f9810f393ecfc925e8097892ffc2174e9235a8ff3f4de7a9cb4b7172b
|
| 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 1, 2026.
Transparency logRelease files / gpui_toolkit-0.9.25-py3-none-macosx_10_13_x86_64.whl
| Download URL | gpui_toolkit-0.9.25-py3-none-macosx_10_13_x86_64.whl |
|---|---|
| Size | 11.6 MB |
| Tags | Python 3 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
8c2f1941049f57b5b2e0de7ff4d1dae2efaec840a51a6dd617162c95eec9dab2
|
|
BLAKE2b-256 checksum How to use checksums |
169de9bded72b665ad234e474462cd8c667ae91ac962020232e37ca1e6d234a2
|
| 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 1, 2026.
Transparency logRelease files / gpui_toolkit-0.9.25-py3-none-any.whl
| Download URL | gpui_toolkit-0.9.25-py3-none-any.whl |
|---|---|
| Size | 10.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46877babe4aad88de9da0120216d875d0a399902b0b942e38171ced50dbd2dd3
|
|
BLAKE2b-256 checksum How to use checksums |
b5c8e4fe57084ff61388b73cd307da67150a4149c387c87807a99bc707f8b16f
|
| 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 1, 2026.
Transparency log