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

Uploaded CPython 3.13Windows x86-64

affineui-0.4.0-cp313-cp313-manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

affineui-0.4.0-cp313-cp313-macosx_11_0_universal2.whl (6.6 MB view details)

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

affineui-0.4.0-cp312-cp312-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.12Windows x86-64

affineui-0.4.0-cp312-cp312-manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

affineui-0.4.0-cp312-cp312-macosx_11_0_universal2.whl (6.6 MB view details)

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

affineui-0.4.0-cp311-cp311-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.11Windows x86-64

affineui-0.4.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

affineui-0.4.0-cp311-cp311-macosx_11_0_universal2.whl (6.6 MB view details)

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

affineui-0.4.0-cp310-cp310-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.10Windows x86-64

affineui-0.4.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

affineui-0.4.0-cp310-cp310-macosx_11_0_universal2.whl (6.6 MB view details)

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

affineui-0.4.0-cp39-cp39-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.9Windows x86-64

affineui-0.4.0-cp39-cp39-manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

affineui-0.4.0-cp39-cp39-macosx_11_0_universal2.whl (6.6 MB view details)

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

File details

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

File metadata

  • Download URL: affineui-0.4.0.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.0.tar.gz
Algorithm Hash digest
SHA256 e3075c121e2257adf350184678607e37afb6fb4f56f2067e423b35b71345ff10
MD5 252b9a93b975a2747988aef7ca51c2a6
BLAKE2b-256 ced4a9173abcd0900c6eb812ea55e9064d983b453e9b2717b815f71d686ac0fa

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: affineui-0.4.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.2 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.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7ff35fda10947b039c7cbfbe41d628bf43673eeb3fc41d778b1ba8d44f1dd87c
MD5 ff9cfb11ab79eee6630c69912c7c242f
BLAKE2b-256 f17536540cf8cf5a119543eb9392f435d8d5d60938f4aa52c9ee91606d316f54

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b8d1bb3b73d9ad552ae0cb6bca4c57e4d1bb5838048ab9c5e2858499c6e8becb
MD5 22f6665bc6d6843fecc35669e6aaa3f4
BLAKE2b-256 e708f23896f43da4890acc83ba4af49af95fa845d0d1af630cd83bfd6f3cfe00

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 9f6218357ea3322edcceadcdbcb1af19bb225dc10c9cfcf79a77a954d1e1674a
MD5 8a1a0bd341b2d32e3be9278bb335c595
BLAKE2b-256 f0969178980c1055a889137fa0bd1812bb498c6546ce69f17088fe57bff2c544

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: affineui-0.4.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.2 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.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7788e3e4bc2b79881be452ada371e92eb59c9b5288cc90974542469850f4c9f3
MD5 66778bf938e288b336feedea28b1eceb
BLAKE2b-256 1ab9d262797e11beb38e70c096e5d083b295da7046cb54f73ff414602a7c1f90

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0c3f691eac963a84842aa3a945cbba9bfff6ecf9b756ec368efd52080473bec1
MD5 8f8dda7bf675fcb2570a08c7185669eb
BLAKE2b-256 3c87ffa1d167e9a4ccaca9feff7a63cdddb17d5ac89185cc08927329299e58c6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 80c7606cf15a24f3d29d9c8afc62aaddcd580c404952c9dfb5620585c5db1364
MD5 043ab3f844f1294b4c5cf93392bed322
BLAKE2b-256 2430b56bedc1667af8780f1a994f8dcf9506a0186c88becc47acca87670ad4b9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: affineui-0.4.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.2 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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5330e04df4fa66feaccb9900baca870333ceb0afec006249eb513fc43d65a4fb
MD5 521265ee361f81b9112704de3436ef0d
BLAKE2b-256 5bc02746ddc9fb16bf517b2931b9af62b62e155f82e659491bd44e3c159b3cb1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a3a48ab9bfd7b94b70dfdf278bf12b87e7f74eaaa194a2ac4ab47de867a47263
MD5 3f03addd9a3db69e96e54ffb433ed161
BLAKE2b-256 a5cc2f1465d26df43145109c77f302bcabea7fabaf9c572b3a4480d6350a1f87

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 f4cf8df613d738856c3f058eb9a635c7e6baf7b3bf49d2ed5e822c2cab6791dd
MD5 81cb612b9562332df8d33d535466f79d
BLAKE2b-256 9b07f474380452bf8b87d42fcc147cc28f116dce5e3b606744c5a5d6e3621d4f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: affineui-0.4.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.2 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.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3cf7ed344faa5367ff5aec539cd7b44b2566f8a6d597ce69126b742a594fb0bd
MD5 ab179ba0793106af3e268c23f0b3c454
BLAKE2b-256 b49a83304d5eea81d4b8f3d04ba1237decc1e8bfd2b5055b29f7e032cf06d54e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 76d9220c70d07dfba4586ab172438777ebcd1cda227763e1161fee1d683400da
MD5 241c4dacd93f1e7f4aa78e450e76d614
BLAKE2b-256 b402c37f2f34121670cbb7b0f4da4a2273e1ab38b7d57a9b00e06aa95bb8f963

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 a633a5c9630379b82d647b8680315642b13818f296d3a92f7a02e7dc902f993c
MD5 2613a19381fea43ad26fc17446e76175
BLAKE2b-256 29a08f5d04ddf287949b3febd0df0ed489563a8da0893b6da49dd6eed4fa3ad5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: affineui-0.4.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.2 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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1b92aae1ea7044aacd7da74437ef84e6f90a082fd66c75655118dbfe79e080d8
MD5 d91d12dc8e24a0ce1b56a0cee65e1af8
BLAKE2b-256 35e0c74e5d32c9fb84b187108b89da5df44b0b4941adfea90c6ad86cf0caad6b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7c4cf25374bb2d3e5ee42a86626bb69b01cfba5ed153bf16aaaccde6f75a683c
MD5 42957d3726548bb9685e18bece58225e
BLAKE2b-256 bc4d25e079c740fb540b6d9c904e514fce23b5fa40b48d737c86eafab7de9646

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for affineui-0.4.0-cp39-cp39-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 9668a05a3b1083ac90552adc213c0e15bcf7f2c58dc4307b10d7d876e0108f4c
MD5 840f417aefcac8c207bab30ec4ed54ac
BLAKE2b-256 26126581ad79258fa7b9d447511d2bda7ca353fa5094e994769f4f6bc3b0440c

See more details on using hashes here.

Provenance

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