Skip to main content

Python bindings for AffineUI — GPU-accelerated HTML/CSS UI for tools and game engines. EXPERIMENTAL preview; APIs will change.

Project description

AffineUI for Python

AffineUI running the Dender 3D-print slicer — the default Decius CSS look AffineUI rendering a Bootstrap dashboard

A small, HTML5-compliant, GPU-accelerated UI renderer with an integrated component framework — a native replacement for Electron and Qt, for Python.

Think Gradio, but native: describe your UI as a tree of typed components, get a real HTML/CSS renderer with a browser-quality cascade, animations, hit-testing, and 120 Hz paint — all in one binary, no browser embedded, no JavaScript runtime, no Electron. Bootstrap and Tailwind-style stylesheets render out of the box; the bundled default is Decius CSS.

Status: alpha. Broad standards coverage, real UIs run today, but expect bugs and expect APIs to move.

Note: this release carries no -alpha suffix in its version number, but AffineUI is alpha and pre-1.0. Features, APIs, and the set of supported platforms are all still in flux.

Verified on: Linux (Ubuntu, x86-64), macOS (Apple Silicon), and Windows (x86-64) — the full suite (600+ tests) passes on each. Other platforms and architectures are not yet supported.


Install

pip install affineui

Prebuilt wheels ship for CPython 3.9 – 3.13 on Linux (manylinux_2_28 x86_64), macOS (universal2 — Intel + Apple Silicon), and Windows AMD64.

For a source install from a clone of the main repo:

pip install ./bindings/python           # regular install
pip install -e ./bindings/python        # editable / dev

Hello, world

Component API (recommended)

import affineui as ui

view = ui.View(ui.ViewTheme.Decius)
view.begin()
view.heading(1, "Hello from Python")
view.paragraph("AffineUI — native HTML/CSS, no browser, no JS.")
view.button("Click me", primary=True, key="go").on_click(lambda: print("clicked!"))
view.end()

app = ui.App(title="Hello", width=720, height=480)
app.load_view(view)
raise SystemExit(app.run())

Raw HTML

import affineui as ui

app = ui.App(title="Hello", width=720, height=480)
app.load_html("""
  <main style="padding: 24px; font-family: sans-serif;">
    <h1>Hello from Python</h1>
    <p>AffineUI is alive.</p>
    <button>Click me</button>
  </main>
""")
raise SystemExit(app.run())

Headless (no window — for CI and tests)

import affineui as ui

doc = ui.document(
    "<main><h1>Hello</h1><p>Layout without a window.</p></main>",
    "main { padding: 16px; } h1 { font-size: 32px; }",
    width=640, height=360,
)
print(ui.version(), doc.content_size())

A modest app

A live-updating counter — state lives in Python; the reconciler diffs your view and patches the DOM in place. CSS hover/focus/animation keeps running between updates.

import affineui as ui

count = 0
app = ui.App(title="Counter", width=480, height=240)

def build_view() -> ui.View:
    view = ui.View(ui.ViewTheme.Decius)
    view.begin()
    view.heading(1, f"Count: {count}")
    view.button("Increment", primary=True, key="inc").on_click(bump)
    view.button("Reset",                    key="reset").on_click(reset)
    view.end()
    return view

def bump():
    global count
    count += 1
    app.load_view(build_view())

def reset():
    global count
    count = 0
    app.load_view(build_view())

app.load_view(build_view())
raise SystemExit(app.run())

The main repo's bindings/python/examples/ ships larger runnable programs — a component gallery, a photo editor, and a full Bootstrap-styled panel demo.


Loading design-system CSS

Decius CSS is the default when you use the component API. To render your own HTML with a framework stylesheet, tell the app where its asset folder is:

app = ui.App(
    title="Bootstrap demo",
    width=1280,
    height=720,
    asset_folders=["examples"],          # so href="frameworks/..." resolves
)
app.load_html("""
  <link rel="stylesheet" href="frameworks/css/bootstrap-5.3.8.min.css">
  <div class="container py-4">
    <button class="btn btn-primary">Native Bootstrap</button>
  </div>
""")
raise SystemExit(app.run())

Bootstrap 4.6 / 5.3, Tailwind-style utility classes, and Ant-style component markup all render — this is a real CSS engine, not an HTML-shaped layout solver.


What AffineUI is not

  • Not a browser. No navigation, no fetch, no cookies.
  • Not a nerfed HTML5. Missing non-esoteric features are bugs.
  • Not a security sandbox. Never feed it untrusted HTML/CSS/JS.
  • Not an everything-included framework. No video decode, no audio, no 3D — those are your app's job.
  • Not (yet) a JS runtime. JS + React support is on the roadmap as an opt-in extension.

See the main README for the full picture, embedding notes, C++ / Rust / C# APIs, and the demo gallery.


Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

affineui-0.4.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

affineui-0.4.1-cp313-cp313-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.13Windows x86-64

affineui-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

affineui-0.4.1-cp313-cp313-macosx_11_0_universal2.whl (3.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ universal2 (ARM64, x86-64)

affineui-0.4.1-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

affineui-0.4.1-cp312-cp312-manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

affineui-0.4.1-cp312-cp312-macosx_11_0_universal2.whl (3.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ universal2 (ARM64, x86-64)

affineui-0.4.1-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

affineui-0.4.1-cp311-cp311-manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

affineui-0.4.1-cp311-cp311-macosx_11_0_universal2.whl (3.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

affineui-0.4.1-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

affineui-0.4.1-cp310-cp310-manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

affineui-0.4.1-cp310-cp310-macosx_11_0_universal2.whl (3.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

affineui-0.4.1-cp39-cp39-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86-64

affineui-0.4.1-cp39-cp39-manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

affineui-0.4.1-cp39-cp39-macosx_11_0_universal2.whl (3.4 MB view details)

Uploaded CPython 3.9macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file affineui-0.4.1.tar.gz.

File metadata

  • Download URL: affineui-0.4.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for affineui-0.4.1.tar.gz
Algorithm Hash digest
SHA256 270ef742c719285ca4be1f36e7262c3d4a3b30639c408ed82db913fbc413cb8b
MD5 5b50b27d866afea0571ac0f44919edf4
BLAKE2b-256 fc618a68bd960e51f9044f25031958413b865cdbf6c39e0cd627ff9c11d1595a

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1.tar.gz:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for affineui-0.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 10286876464830dd5bbb36863d81008e8cd0c666c440d92d032ae5659c8743c8
MD5 18a66f1518e5a6d5ab1d5e4953cffc49
BLAKE2b-256 8f9dd07999996d23aea1390df070aa0ad009fc3dc7dd8732efe05336d17af9bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a0c4e0d93dc0f9abe9c78eab9b1aaa2a42d9474c9009abb25d8f1bb1181662b8
MD5 7f12b201c99cc9f0ae9416b86b2a355b
BLAKE2b-256 a48791ba8c8be576c32918ee66f1281ed149dc6efcab3fb032cf3c4c81513d31

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp313-cp313-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 e909b702ebc08d2e53316fc21e4cc2b05655e4860cd1058afb1a6820429e0f22
MD5 bc126b8c9be180b8cabd8336a7af88b3
BLAKE2b-256 3ce6424e2ea5ecf72952b99ace7e0bf6caf2fde7ad481fa44dfd4d5cad713a25

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp313-cp313-macosx_11_0_universal2.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for affineui-0.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a8e0c0c9c68b163ce71163edd832ba7018a11639163654f1d1d325f46fdfe71e
MD5 efb3dae686cb99664415acafec47f821
BLAKE2b-256 cbd32ef18c2fcabbd3d3f024b1d5ca92ecc63041dd5b1b05a35715d7fe57ede5

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dbac7d370ddc4399e9bd1c413ccf320421884c8733e561cb9ce6e39207f99622
MD5 54605a5c5e5586707d7037e993e67cae
BLAKE2b-256 152adf6891a0570408f6f666b52fd2e6a51a2023ccab0a6d49d300f42a2a18ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 f5020c4fe22f2db55f2c0cc5b70a32580613d52eb007453c84c07db7ae7d895b
MD5 8f75aa10485d0cc4d3b99c7dded755ba
BLAKE2b-256 cf5427ffb298481de5c9704a983c484fe66404f78693ac6f02f75d08a3b6004d

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp312-cp312-macosx_11_0_universal2.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for affineui-0.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 971903117d3169c028b9f2602008add52bcabfa3c2d92d596b8f01fb92423f65
MD5 310d20c79412736cba0b23fb5d2eb008
BLAKE2b-256 3387b7864e766d2f128a3e982cc754786ecc814062a54ca00b763bc8cc6330ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 097e443683ac62279b5a1f145d51f92ab60d15027606281ca1f889cd370b985e
MD5 f148cc68b6a9a31e77ba14e4bf517aba
BLAKE2b-256 0d32444f4f7e7833102d71c33558b565777cdad770e4eb2028beaff7f03b6a93

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 1346c1074de71ce75e37bedc699d25633f0b2514ce52fdd9dae41006bd49c350
MD5 a182ed21dca19893d3bc2ef6b61289a2
BLAKE2b-256 0b1648f13cb9f79f001a36b5f569a772d897c4f9621f414b30b4b3a51d635fea

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp311-cp311-macosx_11_0_universal2.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for affineui-0.4.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b63a1f7d01cf711cf182536d799d4a3c5540971a2d644110abe89052b917a7bd
MD5 54bb931472ef54500a0971883567deb1
BLAKE2b-256 05c36357ca1ed7ebc0ea1a4e72aef21bbc7261affee516c541a1856c53212350

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c5fb0d6dd8b54c2a7c7e0bb29e4f808d9baa66e68d0b0a6163f9f0c8363d3a40
MD5 143f916a1e46bfe34470d310642b73e7
BLAKE2b-256 bd36ce136286dd4a81398268d6316c8f69dbd76bf102e94ec1e940cd99976d4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 90f0afcefd8ea7747e1a02566c84af9c883a93a5d2fb54a414a3c55522482c46
MD5 f76a9f6320046005387ba21368b38580
BLAKE2b-256 3d600a466e3e0c1b4bd7b01c309c479b50331379744d1ec04f0094e3b3c0cae6

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp310-cp310-macosx_11_0_universal2.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for affineui-0.4.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8d46c2d01844671c4675344301375880baaa3c4eb4a3380cddb6857745a77fad
MD5 00d3ef09fa04d0551626a463702f3bfc
BLAKE2b-256 1ed08049130eb0b7f5025669958e83b5a0978b1b41f43e450d39e18f36911d84

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp39-cp39-win_amd64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e068fa7107d7f86555884f3e61d29cab2b34e8c5047d9bb3927b8315fac48c48
MD5 331e86c59f110de018075859d1ebb5e9
BLAKE2b-256 37ac313c4a4d6978fb6f66bb5d457d8bbb342fd6d855286432e45dceed871aa1

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp39-cp39-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file affineui-0.4.1-cp39-cp39-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.1-cp39-cp39-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 4d988bed3e8053f118a03c5dda010ce19cebe38b5809d8528029982bcbdfcab7
MD5 f543ff813410ac743b026fe6646f219d
BLAKE2b-256 4240ba98a23e60041ee8c4db3a7be389b6cc4298df488e54f31d03cbf0fa7c0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.1-cp39-cp39-macosx_11_0_universal2.whl:

Publisher: wheels.yml on affineui/affineui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page