XRack Python bindings
load_file(path) compiles an .xr file and resolves its imports and assets. load_mlir_file(path) loads exported XRack MLIR and its file resources. Call program.create(name) to instantiate an exported component.
The Python API reads and writes public properties with get and set, restores declarative bindings with reset, and exposes callbacks through on and invoke. Coroutine handlers can be connected to void callbacks.
Public values include Python scalars and string lists, plus XRack types for lengths and percentages, colors and brushes, dates, times, fonts, styled text, images, records, input events and enums. The same types are used for property values and callback arguments and results.
ui.set("accent", xrack.Color.from_hex("#536dfe"))
ui.set("spacing", xrack.Length(12))
ui.set("direction", xrack.LayoutDirection.RightToLeft)
ui.get("names") returns a string-list snapshot. ui.string_model("names") gives you the live model of a writable list. Use ui.record_model("rows") to append, replace, or delete individual records. A replacement keeps the row identity. XRack validates a new row against the schema before writing it. ui.get("rows") remains a snapshot.
Use the live models and UI-owned values such as images and records on the main thread. From a coroutine, pass plain data back and construct or inspect these values inside call_on_ui.
Run the existing asynchronous search UI with Python business logic:
bazel run //bindings/python:async_demo
Call ui.run() on Python's main thread. XRack owns the native window there and runs a standard asyncio loop on a dedicated Python thread. Synchronous callbacks run on the main thread. Coroutine handlers can use asyncio.sleep, asyncio.open_connection, and asyncio.to_thread. Use await ui.call_on_ui(ui.set, "loading", True) to make a UI change from a coroutine. The native binding uses pyo3-async-runtimes to return the result or exception to the caller's event loop. You can also pass an async startup function to ui.run(main).
Closing the last window cancels outstanding asyncio tasks and waits for their cleanup. Coroutine cancellation is cooperative. Work already running in asyncio.to_thread follows Python's executor shutdown behavior. Start the native event loop once per process.
Use ui.on_request("search", search, publish) when a coroutine produces a result for the UI. The .xr callback is declared without a return value. The Python search coroutine can return any Python value accepted by publish, and only the latest request for that callback applies its result. Optional on_start and on_error hooks run on the UI thread, along with publish. See the asynchronous search example for how to update the loading state.
Use await ui.invoke_async("result-label", item) from a Python coroutine to retrieve an immediate XRack callback result. If the callback starts an asynchronous handler, the await finishes after the callback schedules the handler.
Build a native wheel with bazel build //bindings/python:wheel. Bazel generates xrack/_native.pyi from the native binding and includes it and py.typed in the wheel. For example, install the macOS ARM64 build as follows:
bazel build //bindings/python:wheel
python3.11 -m venv /tmp/xrack-python-venv
/tmp/xrack-python-venv/bin/pip install bazel-bin/bindings/python/xrack-0.7.0-cp311-abi3-macosx_13_0_arm64.whl
/tmp/xrack-python-venv/bin/python bindings/python/async_demo.py examples/async_demo/async.xr
From an installed package, run python -m xrack.stubgen ui/async.xr -o async_ui.pyi. This writes async_ui.py and async_ui.pyi together. Import AsyncDemo from async_ui to use typed properties such as ui.query and typed callback registration such as ui.on_search(handler). Re-run the generator after changing the component's public API.
Open the Python example as a reloadable application with bazel run //bindings/python:async_demo -- --live --project "$PWD". You can also pass live=True to xrack.load_file or to a generated component constructor. On Unix, open the project directory in VS Code and run XRack: Sync Editor to Running App to attach.
Format Python sources with bazel run //bindings/python:format -- <files>.
Run the binding tests with bazel test //bindings/python:binding_test. On a desktop session, run bazel test //bindings/python:window_test to exercise an actual window, and add --test_arg=--close-early to test cancellation.
PyPI releases
The Python workflow builds CPython 3.11+ wheels for macOS ARM64, Linux ARM64 and x86-64, and Windows ARM64 and x86-64. The macOS wheel targets macOS 13 or later. Linux wheels are repaired and checked for the manylinux glibc 2.39 baseline. Each job installs its wheel into a clean virtual environment and runs the binding tests.
A stable version tag on main publishes the five verified wheels. The tag must match the workspace version and the wheel version. For the first release, configure a PyPI pending publisher for the distribution xrack with owner smallsunsun1, repository xrack, workflow python.yml, and GitHub environment pypi.
Metadata
Release files for xrack 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| xrack-0.7.0-cp311-abi3-win_arm64.whl | CPython 3.11 | abi3 | Windows ARM64 | Details for xrack-0.7.0-cp311-abi3-win_arm64.whl |
| xrack-0.7.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for xrack-0.7.0-cp311-abi3-win_amd64.whl |
| xrack-0.7.0-cp311-abi3-manylinux_2_28_x86_64.manylinux_2_39_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.39+ x86-64, Linux glibc 2.28+ x86-64 | Details for xrack-0.7.0-cp311-abi3-manylinux_2_28_x86_64.manylinux_2_39_x86_64.whl |
| xrack-0.7.0-cp311-abi3-manylinux_2_28_aarch64.manylinux_2_39_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.39+ ARM64, Linux glibc 2.28+ ARM64 | Details for xrack-0.7.0-cp311-abi3-manylinux_2_28_aarch64.manylinux_2_39_aarch64.whl |
| xrack-0.7.0-cp311-abi3-macosx_13_0_arm64.whl | CPython 3.11 | abi3 | macOS 13.0+ ARM64 | Details for xrack-0.7.0-cp311-abi3-macosx_13_0_arm64.whl |
Total release size: 70.8 MB
Release files / xrack-0.7.0-cp311-abi3-win_arm64.whl
| Download URL | xrack-0.7.0-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 11.2 MB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5b01764cab1f77eb8bd041fbbb1eae14739ff387ee2eea346f52396d0c3141b8
|
|
BLAKE2b-256 checksum How to use checksums |
410cb05cf1beb167f28e8529e12e6055d35ccbb904da30ce1025f9a6c13cc71d
|
| 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 17, 2026.
Transparency logRelease files / xrack-0.7.0-cp311-abi3-win_amd64.whl
| Download URL | xrack-0.7.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 12.0 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
eb7d131295c1b4f001c926959d555dfab7b0fd4772f9c24be4944457ecbb03de
|
|
BLAKE2b-256 checksum How to use checksums |
a6f9105b221e6e4ba8e8e61a2e6a9a007df69b9cf97899b56d6e3ecfe84aa262
|
| 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 17, 2026.
Transparency logRelease files / xrack-0.7.0-cp311-abi3-manylinux_2_28_x86_64.manylinux_2_39_x86_64.whl
| Download URL | xrack-0.7.0-cp311-abi3-manylinux_2_28_x86_64.manylinux_2_39_x86_64.whl |
|---|---|
| Size | 17.5 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.39+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e1e514445ff7d574eab3d38fffa2c0284de8ab1549f83363ace1bbd3a27f50d9
|
|
BLAKE2b-256 checksum How to use checksums |
a529bedb1ff2cebd4a4d46825d7ffb092cc41b351fa977c5664bfb7bc9d17513
|
| 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 17, 2026.
Transparency logRelease files / xrack-0.7.0-cp311-abi3-manylinux_2_28_aarch64.manylinux_2_39_aarch64.whl
| Download URL | xrack-0.7.0-cp311-abi3-manylinux_2_28_aarch64.manylinux_2_39_aarch64.whl |
|---|---|
| Size | 17.4 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 Linux glibc 2.39+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
929c7db2eb575c634278939166a6d06e8816d71bccd2e45d8163258e73ef1fe2
|
|
BLAKE2b-256 checksum How to use checksums |
10f618b908059fac0b0a1cda78aed4f7a1784b0fab8566042a30cc9d36ea5fd2
|
| 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 17, 2026.
Transparency logRelease files / xrack-0.7.0-cp311-abi3-macosx_13_0_arm64.whl
| Download URL | xrack-0.7.0-cp311-abi3-macosx_13_0_arm64.whl |
|---|---|
| Size | 12.6 MB |
| Tags | CPython 3.11 abi3 macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
718cf3916519f1abfda5819927edf4c57f87402868886c14ab55df473cfae940
|
|
BLAKE2b-256 checksum How to use checksums |
f64147ba7167c1577a95fb33e5d3ecc9dd2f28c24ead477ec6e7d51db391a279
|
| 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 17, 2026.
Transparency logSecurity for xrack 0.7.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.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for xrack-0.7.0-cp311-abi3-win_arm64.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 17, 2026.
Transparency logA 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.