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.2.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.2-cp313-cp313-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.13Windows x86-64

affineui-0.4.2-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.2-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.2-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

affineui-0.4.2-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.2-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.2-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

affineui-0.4.2-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.2-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.2-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

affineui-0.4.2-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.2-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.2-cp39-cp39-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86-64

affineui-0.4.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: affineui-0.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 c9e113b07243fed95769d0e8417b10779dbab1cd5ea3a65ab0322ea3a12d6eb0
MD5 dcc007e9aedd66fb6c4fdce3371ef78c
BLAKE2b-256 070a776694c29fa3934bb42419273fba5a587d444a7eebb10351d156616aa49c

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2.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.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.2-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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9faddefbe86264f491e1fc131a9da2e72a39b0a7ef988d257dfe9c1614e191d7
MD5 06954e3d9ef8403d4c538d3429e8bcf0
BLAKE2b-256 88bc11c38d7a529711312bb7402b7188604da9de032906d7a9877d0ba53a8d6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cd44f1c7488f45d622d149193d6820b0b1ebd585f45e060f5b32713aa44bb576
MD5 f550bf3c6376b8e94b08a49c53a9b507
BLAKE2b-256 74e3312d21dd4c82a84ca001b867ca9e1c3b4044ef0c534bc7ca1721b34d89fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp313-cp313-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 9783542af36ccb59cea00f37877755f588cd74088f598803705c1181ff8ae6c5
MD5 97c650ecebf407866a3f2b633bf76161
BLAKE2b-256 49d1e371daee97a3757fec5ab5abb4fc54013e59a11f830f5ce9ea698c9c817c

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.2-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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5cdbbca6cead0b444985d73dad4e9b2067f65ce8291281651b283a8124276cea
MD5 c24d999e469854fb39dbd4cac4563d0f
BLAKE2b-256 fc19d9c065e7b54e378413bb56b0e6eecae808e139a4d5a0e6b3dd5fdeea38e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c5917ea7e48e0042e58fa3dd2d5531a5cedcda765d0a74e101f3c434eb4d40d
MD5 58cdb3c2924403169b77a5f98be4bbce
BLAKE2b-256 04670d074f76ebf2c6420ba51a090a65b743347492ed494773693408dcda06e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 d486aaef6436c90ccfe3be4a7d50e97435b33458b74a6e7de7685711079d011e
MD5 ee1a46c5fe39f90ec4ec54429f1bb9bf
BLAKE2b-256 58211c5b1b4418730457b0bfe1480608e5324acaacee5ff768073f04375bf80b

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.2-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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 597e2e0d749cf7394772ba83a3ce3a27f60cb8b581ce025053d91b321d8ef0da
MD5 623c2e365b6e5e72de758687c50f3cf0
BLAKE2b-256 d097b08d7c50209e4d5355843650186828e2f63ffc219bca2188b6c50e308f14

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5a8ece082140a8d03a39dca353c9db46675746e28cc88aeffae541e274728e99
MD5 f0a2c231f9e794fba01e4dc2e7dd5e90
BLAKE2b-256 75abc6d839953e097bf40fc5992c32673dc2a35e2aaeabdfd18d91fa291f7a71

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 b3ea36677fa36d653e6ce9f915cfcc24e7882cf73acaa1733cf666bc58e4ada7
MD5 c2fa348b264c666211f84ffb471b4ddb
BLAKE2b-256 ac53a27a95fb10fd843299dde3a0fa78e807925ff965b3887bd305ea2d2d200e

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.2-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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 357154a5b4080f1d176712a9ef8793d980ce9212334ff19cf600c35e0ed56c24
MD5 07e01fa652d112e44ba403970c37e7cd
BLAKE2b-256 388fcf412adf2846776a1c0762b971f6da709b7fcfb99709a39258a310999359

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4fbcc969e20eaf0b3fcab45ec337b3adc5b2a13e0b19d408136cf7e443dc64c
MD5 df16a169fedf2c15410a64e41d3dbdc7
BLAKE2b-256 5ef70e9e8f7e982e9903803e7f0563cb1aff11971b477a8eb3e551165996a859

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 03cc5135270597e99e390bb144dc6a542cf340ffa285ad780e6724fcef4d9641
MD5 d0afcc824bd74021c2fd7c41c6872b5f
BLAKE2b-256 d7420b9d78182ebb2ca9276890cbb6fa10e5a558891142bcce36342b24583be0

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: affineui-0.4.2-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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0a98891d627263864db4b561803eeecc724f297746429f7c867ae69d719fe73e
MD5 02348a13adfffcba00d22340caf45d0d
BLAKE2b-256 82e222b174f197874fa8f4fd56cbe758c092d2d0e78812d10d837183d8bfe2bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 00c7f01223cfc9653ecd7bfc6b9bea8be4c96fb221b46f3883c0d34d33c6e0cd
MD5 51ec5a2e4d795d19e327f7bdea66e9de
BLAKE2b-256 76dc1a882a9d2b6cdece9ffca80cc88af5c2e6b12c79632288531fda8d361900

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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.2-cp39-cp39-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for affineui-0.4.2-cp39-cp39-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 916df7ab6c0aefefe8335f7f65c7f57393aa58f2f3667214db11f982a7ae4a9b
MD5 3f7418bf6a40685e3099f74acecba57a
BLAKE2b-256 53b9e2902a8eb9f583370c309d7167a23f36fad158fcbc74ec5085cfb79853a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for affineui-0.4.2-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