Skip to main content

gpyui

A native Python UI library powered by GPUI (source) and Longbridge's GPUI Kit (source), with a PyO3/maturin extension. Rust owns windows, rendering, focus and text editing; Python owns composition, application state and callbacks.

The goal is a reusable desktop UI toolkit: write complete applications in Python, as you would with Tkinter, using GPUI Kit components through Python controls. Application authors should not need to write Rust. There are now 71 Python controls, including native Kit inputs, navigation, tables, charts, overlays, rich text and feedback components. These are initial wrappers for the catalog; component coverage records the supported properties and the specialized Kit APIs still to expose.

gpyui is a working name. Package-name availability has not been checked.

Documentation

The Zensical documentation includes guides, API references and a visual catalog of all 71 controls, each with a real native preview, properties, events and a runnable Python example.

Preview it without building the Rust extension:

UV_PROJECT_ENVIRONMENT=.venv-docs uv sync --locked --only-group docs
UV_PROJECT_ENVIRONMENT=.venv-docs uv run --locked --only-group docs zensical serve

Open http://localhost:8000. See documentation development for strict builds, generated-reference checks, native captures and optional Pages publication. Pull requests include a built HTML preview artifact.

from gpyui import Application, Button, Column, Label, TextInput

app = Application(title="Hello")
with app, Column():
    Label("Name")
    name = TextInput(placeholder="Enter your name")
    greeting = Label("Enter a name and choose Greet")
    Button("Greet", on_click=lambda: setattr(greeting, "text", f"Hello, {name.value or 'world'}!"))

app.run()

Explicit composition also works: Application(Column([Label("Hello"), ...])). See examples/async_binding.py for State, two-way input binding and an async callback.

Native trading demo

The paper-trading workspace is a simpler desktop example inspired by a multi-pane trading terminal. A seeded, local stream updates the watchlist, price, percentage change, rolling chart and market tape every 650 ms. Its native button runs an async Python callback and fills a paper order at the current simulated price. The animation shows Buy/Sell orders and switching to AAPL while quotes continue updating. The component gallery demonstrates the reusable controls. These are captures of the actual GPUI windows, rendered on Linux with Xvfb and Mesa Lavapipe.

Native trading workspace with simulated live quotes, trade tape and paper orders

The 12-second GIF records the actual native window at 10 fps. All data and trades are simulated locally; the example makes no broker connections.

Still screenshots and component gallery

Paper-trading workspace in dark appearance

Paper-trading workspace in light appearance

Native component gallery

uv run python examples/workspace.py --theme dark
uv run python examples/workspace.py --theme light
uv run python examples/workspace.py --static  # freeze prices
uv run python examples/gallery.py

To regenerate the GIF on Linux, install Xvfb, xdotool and FFmpeg, then run:

uv run python scripts/record-workspace.py

The recorder starts a free Xvfb display when needed, activates controls with real mouse/keyboard events, captures the native window and verifies the resulting orders and clean shutdown. Temporary video, logs and snapshots go to artifacts/.

Compose and bind Kit controls

from gpyui import Application, Checkbox, Column, Label, Slider, State

enabled = State(True)
app = Application(title="Settings", theme="dark")
with app, Column().style(gap=16):
    Checkbox("Enable notifications").bind_value(enabled)
    Label().bind_text(enabled, lambda value: "Enabled" if value else "Disabled")
    volume = Slider(35, on_change=lambda event: print(event.value))
app.run()

Use with Row():, GroupBox("Title"), Scroll() and Resizable(children=[...]) for composition. .style(...) accepts pixel dimensions and spacing plus semantic theme colors, such as color="muted_foreground". Application(theme="light") and Application(theme="dark") choose the initial native theme. Mutable collection properties, such as Table.rows and LineChart.data, update through assignment; their getters return copies. See the coverage and API guide.

Build and run

The Build wheels workflow builds Linux x86_64 wheels and a source archive, tests the installed wheel on Python 3.12–3.14, and uploads downloadable artifacts. Optional PyPI Trusted Publishing runs from a matching version tag after explicit selection in a manual workflow run. See wheels and release setup.

Python 3.12+ and the pinned Rust toolchain are required. Native Linux builds need development packages for X11/XCB, xkbcommon, Wayland, fontconfig, FreeType and a Vulkan driver. Typical Debian packages:

sudo apt-get install build-essential pkg-config libclang-dev libfontconfig-dev \
  libfreetype-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-xkb-dev \
  libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libvulkan-dev \
  mesa-vulkan-drivers
uv sync --locked
uv run python examples/hello.py
uv run python examples/async_binding.py

The generated project started with uv init --lib --build-backend maturin --vcs git /workspace/glint, then was renamed at the user's request. The initial uv_build scaffold was preserved separately before reinitialization.

In this cloud workspace, the toolchain and Debian packages were installed locally without root access. Use:

cd /workspace/gpyui
source scripts/workspace-env.sh
uv sync --locked
uv run python examples/hello.py  # requires an actual display

Callback and update contract

  • run() owns the main-thread native event loop and blocks until close. One native run per process, one window, static mounted tree in this milestone.
  • Callbacks execute on the gpyui-asyncio worker thread. A callback may require zero arguments or one Event. Handlers with no required arguments are called without an event. Both async handlers and returned awaitables are supported.
  • Keep synchronous handlers short. Use await asyncio.to_thread(...) for blocking work; marshal UI mutations back to the callback loop. app.call_soon provides this handoff for other threads. Existing main-thread asyncio loops cannot host run() yet.
  • Property assignments automatically coalesce by control/property per asyncio turn. with app.batch(): ... groups synchronous assignments. app.update() flushes immediately; neither is a rollback transaction.
  • await app.snapshot() flushes and returns applied native properties, indexed by control ID. This is a command barrier, not a GPU presentation fence.
  • Rust interactions update Python control .value and any bound State before on_change. Button activation carries a current value snapshot, so a handler reading name.value sees the input at activation. Native edits never pass through Rust set_value, preserving native cursor/selection/undo.
  • Assigning TextInput.value deliberately replaces the editing buffer and clears undo history, following upstream InputState.set_value. It emits no user change callback. .value elsewhere is an asynchronously received mirror; use a snapshot when authoritative native state is needed.
  • State uses explicit observers and equality guards. Label.bind_text(state) binds one way; input/selection controls' .bind_value(state) binds both ways. unbind() removes subscriptions. Mutate bound state on the callback loop while running.
  • app.close() requests shutdown. Native window close cancels awaiting handlers, gathers tasks, closes the asyncio loop, joins its worker, and unbinds controls. Cooperative cancellation cannot terminate an indefinitely blocking sync handler.
  • Callback exceptions go to on_error(exception) or asyncio's exception handler and remain available in app.errors. Queue overload is explicit, not silent.
  • Dialog and Sheet own Python-composed contents; .open() and .close() queue native overlay operations. One of each per window is currently supported. app.notify(message, title="...", variant="success") shows a native Kit toast.

Validation

The Justfile provides development commands, and Lefthook runs Ruff lint/format checks and ty on commit, then all Python checks before push. Tool versions are pinned in uv.lock. Set up once:

uv tool install rust-just==1.58.0
just hooks

just hooks installs tools into .venv-tools and installs the Git hooks. The checks do not build the native extension or replace the native .venv:

just check          # Ruff lint, formatting and ty across src/examples/scripts/tests
just format         # safe Ruff fixes and formatting
just typecheck      # ty only
just test           # Python and Rust bridge tests; native build prerequisites needed
just test-native    # actual native-window interaction tests
just rust-check     # cargo fmt and clippy
just docs-check     # generated references, strict docs build and link checks
just --list         # all available commands

Ruff checks staged Python files before commit. ty checks the entire Python tree when Python code or project configuration changes. Hooks report failures without modifying or restaging files. CI runs just check on every PR and main-branch push using a tools-only environment.

Equivalent direct commands for native verification:

uv run pytest -q
cargo check --locked
cargo clippy --locked -- -D warnings
cargo fmt --check

For actual native-window interaction tests, install Xvfb, xdotool and optionally ImageMagick, then run scripts/test-native.sh. The script uses a free virtual display and the local Mesa driver in this workspace. It tests native text input, pointer and keyboard button activation, Python label updates, async binding, exceptions, close/cancellation, catalog rendering, light/dark workspaces, paper orders and native dialog/sheet dismissal. Logs, screenshots and native snapshots go to artifacts/ (gitignored). Tests otherwise skip explicitly when native testing is not enabled.

Read docs/architecture.md for the source-grounded NiceGUI/Flet comparison, design decisions and implementation plan, docs/upstream-lock.json for revisions, and docs/validation.md for measured results and limits.

Linux/X11 has native interaction tests. The wheel workflow covers Linux, Windows and macOS on x64 and ARM64; Windows/macOS use native window smoke tests. Wayland, multiwindow, dynamic topology, large control sets and additional wheel platforms remain follow-on work. This prototype does not claim complete Kit API coverage or production readiness.

Metadata

Release files for gpyui 0.1.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 gpyui 0.1.0
File Size Uploaded Provenance Actions
gpyui-0.1.0.tar.gz 1.6 MB Without provenance Details for gpyui-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for gpyui 0.1.0
File Actions
gpyui-0.1.0-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details for gpyui-0.1.0-cp312-abi3-win_arm64.whl
gpyui-0.1.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for gpyui-0.1.0-cp312-abi3-win_amd64.whl
gpyui-0.1.0-cp312-abi3-macosx_12_0_x86_64.whl CPython 3.12 abi3 macOS 12.0+ x86-64 Details for gpyui-0.1.0-cp312-abi3-macosx_12_0_x86_64.whl
gpyui-0.1.0-cp312-abi3-macosx_12_0_arm64.whl CPython 3.12 abi3 macOS 12.0+ ARM64 Details for gpyui-0.1.0-cp312-abi3-macosx_12_0_arm64.whl

Total release size: 42.4 MB

Release files / gpyui-0.1.0.tar.gz

Download URL gpyui-0.1.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
e4a292d400e2150e43ddc3c7309716a7866555025cba676a0d30532bde48586f
BLAKE2b-256 checksum
How to use checksums
e3b82d34d4895172aa4d302a74a69c094d1828227b3b9b7d6f30716c96332a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gpyui-0.1.0-cp312-abi3-win_arm64.whl

Download URL gpyui-0.1.0-cp312-abi3-win_arm64.whl
Size 10.7 MB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
9cd33b689a73d005e502538bd16054433c857e3c82513263e377c72529f8b95e
BLAKE2b-256 checksum
How to use checksums
00ad4ce649950c479c05f4e390ba9acd25058edb964e67b8e183f9b251265735
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gpyui-0.1.0-cp312-abi3-win_amd64.whl

Download URL gpyui-0.1.0-cp312-abi3-win_amd64.whl
Size 11.2 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
79a65527c10ddb98dc4f139ef996f9c218f023b7e37061412f47b076c2bfe4e0
BLAKE2b-256 checksum
How to use checksums
c59a96210a4aef17b4f75c15b20cb6bea1250b6a593d9e8a90c06f5517915008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gpyui-0.1.0-cp312-abi3-macosx_12_0_x86_64.whl

Download URL gpyui-0.1.0-cp312-abi3-macosx_12_0_x86_64.whl
Size 9.6 MB
Tags CPython 3.12 abi3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
87852df48075666b030fcb8325fbefca4e2115ba53a91226e8bb79522701926d
BLAKE2b-256 checksum
How to use checksums
e9d991fa6d096e860b441d7d68b39dad0e9051634e65e1060dcccc883f6db293
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gpyui-0.1.0-cp312-abi3-macosx_12_0_arm64.whl

Download URL gpyui-0.1.0-cp312-abi3-macosx_12_0_arm64.whl
Size 9.3 MB
Tags CPython 3.12 abi3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
66f53420aad0b5b466cc90594c56bbc150cf6774810f00f95069b37db1b0f3f5
BLAKE2b-256 checksum
How to use checksums
dff8dbef441d622cd25f0f3d5bd5703ba11796d29e443a8fda99d05f31e00598
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gpyui 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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