Skip to main content

Luvatrix

Luvatrix is a Python app protocol and rendering runtime for building custom apps that can run headless, on macOS, as static browser-side web apps, and through scaffolded native Android/iOS projects.

Install

Requires Python 3.14 (requires-python is >=3.14,<3.15). Repository workflows pin the free-threaded build in .python-version (3.14+freethreaded).

Base install:

pip install luvatrix

Optional extras:

pip install "luvatrix[desktop]"          # torch, used by the CPU frame pipeline and several tests
pip install "luvatrix[dev]"              # matplotlib
pip install "luvatrix[macos]"            # PyObjC/AppKit/Quartz/Metal and torch
pip install "luvatrix[vulkan]"           # Python Vulkan binding
pip install "luvatrix[macos,vulkan]"     # required together for --render macos
pip install "luvatrix[web]"
pip install "luvatrix[android]"
pip install "luvatrix[ios]"

The base package intentionally includes common raster/data dependencies (numpy and Pillow). Platform-specific renderers still live behind extras. The web, android, and ios extras are placeholders with no extra pip packages. Browser apps are built and served with the standard library. Native Android and iOS runtimes come from the app-owned scaffold, not from those extras. Installing luvatrix[ios] does not install macOS PyObjC bindings, Vulkan bindings, or Android-only helpers. iOS ABI-specific packages are prepared by the native scaffold's ios/scripts/setup_ios.sh and copied into the app-owned PyPackages bundle. --render macos checks for both the macos and vulkan modules. --render macos-metal checks for the macos extra only.

Create An External App

Create a standalone app outside this repository:

luvatrix init-app my_app --platform-support linux
cd my_app
luvatrix validate-app . --render headless
luvatrix run-app . --render headless --ticks 1

The default init-app template sets platform_support = ["macos", "ios", "android", "web"]. Headless validation uses the host OS only when it is listed, or when the app lists exactly one platform. On Linux, validate and run that default app with an explicit target such as --render web, or pass --platform-support linux (repeat the flag for more than one platform). examples/hello_world omits platform_support, so headless validation accepts the current host.

For an Android-only app, validate against the Android runtime from your development machine:

luvatrix init-app my_android_app --template camera
cd my_android_app
luvatrix validate-app . --render android-emulator
luvatrix run-app . --render headless --ticks 1

Build and serve a browser-side app:

luvatrix build-web . --out dist/web
luvatrix serve-web .

Run with macOS rendering:

pip install "luvatrix[macos,vulkan]"
luvatrix validate-app . --render macos
luvatrix run-app . --render macos

Native Scaffolds

Native Android and iOS projects are app-owned. Scaffold them into your app repository when you need native targets:

luvatrix init-native . --target android --out android
luvatrix init-native . --target ios --out ios

Initialized native projects include per-file scaffold provenance. Upgrade untouched template files while preserving app customizations with:

luvatrix upgrade-native . --target android --out android

For native projects created before provenance tracking, run once with --adopt. Customized files are preserved and current-template candidates are written under .luvatrix-scaffold-updates/ for review.

Measured release improvements and their raw trial data are indexed in docs/performance/.

Then run with the app-owned native project:

luvatrix run-app . --render android-emulator --native-project android
luvatrix run-app . --render ios-simulator --native-project ios

Native prerequisites:

  • Android: Android SDK, ADB, Gradle/Android Gradle Plugin support, and a configured emulator or device.
  • iOS: Xcode, xcodegen, signing for physical devices, and the iOS Python support assets prepared by the scaffold's ios/scripts/setup_ios.sh.
  • Vulkan on macOS: the Python vulkan binding plus a native Vulkan SDK/loader such as Vulkan SDK or MoltenVK.

Native package sync also prunes unrelated platform runtimes from app bundles. Android bundles keep the Android runtime tree, iOS bundles keep the iOS runtime tree, and sibling macOS/web/native-template trees are left out unless that target is being packaged.

App Layout

A minimal Luvatrix app is just:

my_app/
├── app.toml
└── app_main.py

app.toml declares the app id, protocol version, entrypoint, capabilities, platform support, display metadata, and render preferences. The Python entrypoint returns an object compatible with init(ctx), loop(ctx, dt), and stop(ctx), or a subclass of luvatrix.app.App.

Public app-developer API:

from luvatrix.app import App, AppContext, validate_app_install

See docs/app_protocol.md in the repository for the detailed protocol contract.

Google Sign-In

Luvatrix provides an in-app sign-in control and an event-driven controller. The user starts inside the app, authenticates in Google's trusted system browser surface, and returns to the same app through its configured callback URL.

from luvatrix.app import App
from luvatrix.auth import (
    GoogleOAuthClient,
    GoogleOAuthConfig,
    GoogleSignInController,
    PlatformGoogleAuthSession,
    SecureTokenStore,
)
from luvatrix.auth.ui import GoogleSignInButton


class MyApp(App):
    def init(self, ctx):
        session = PlatformGoogleAuthSession(open_browser=my_native_bridge.open_google_auth)
        store = SecureTokenStore(
            read_secret=my_native_bridge.read_secret,
            write_secret=my_native_bridge.write_secret,
            delete_secret=my_native_bridge.delete_secret,
            key="google-account",
        )
        oauth = GoogleOAuthClient(
            GoogleOAuthConfig(
                client_id="YOUR_CLIENT_ID.apps.googleusercontent.com",
                redirect_uri="com.example.app:/oauth2redirect",
                scopes=("openid", "email", "profile"),
            ),
            token_store=store,
        )
        self.google = GoogleSignInController(
            oauth,
            session=session,
            invalidate=self.invalidate,
        )
        self.google_button = GoogleSignInButton(self.google)

    def loop(self, ctx, dt):
        state = self.input.snapshot()
        self.google_button.update(state, x=24, y=24, width=220, height=44)

    def render(self):
        with self.frame(clear=(14, 18, 26, 255)) as frame:
            self.google_button.render(frame, x=24, y=24, width=220, height=44)

The native callback handler calls session.deliver_callback(callback_url). Android bridges should open a Custom Tab and back SecureTokenStore with Android Keystore. iOS bridges should use ASWebAuthenticationSession and Keychain. InMemoryTokenStore remains available for tests, but production apps should not use it for long-lived refresh tokens. Mobile apps must not embed a Google client secret.

Prepared Text Wrapping

Luvatrix includes an optional, dependency-free prepared wrapping style inspired by the MIT-licensed Pretext architecture. Text is segmented and measured once; changing only the available width reuses those native measurements.

Scene/UI text uses TextWrapping on TextComponent:

from luvatrix.app import TextWrapping
from luvatrix_ui.text import TextComponent

body = TextComponent(
    component_id="body",
    text="A paragraph which should wrap across multiple lines.",
    max_width_px=320,
    wrapping=TextWrapping(white_space="normal"),
)

Matrix text uses the same layout engine and its matrix-font measurements:

from luvatrix.app import draw_text_to_matrix

draw_text_to_matrix(
    matrix,
    "A paragraph rendered into an RGBA matrix.",
    x=12,
    y=12,
    font_size_px=12,
    max_width_px=240,
    wrapping="pretext",
    line_height_multiplier=1.2,
)

white_space="pre-wrap" preserves repeated spaces and hard line breaks. Ordinary wrapping collapses whitespace and uses grapheme-safe emergency breaks for content wider than a complete line.

Metadata

Release files for luvatrix 0.2.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for luvatrix 0.2.11
File Size Uploaded Provenance Actions
luvatrix-0.2.11.tar.gz 1.0 MB With provenance Details for luvatrix-0.2.11.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for luvatrix 0.2.11
File Interpreter ABI Platform Actions
luvatrix-0.2.11-py3-none-any.whl Python 3 none any Details for luvatrix-0.2.11-py3-none-any.whl
luvatrix-0.2.11-cp314-cp314-android_24_x86_64.whl CPython 3.14 CPython 3.14 Android API level 24+ x86-64 Details for luvatrix-0.2.11-cp314-cp314-android_24_x86_64.whl
luvatrix-0.2.11-cp314-cp314-android_24_arm64_v8a.whl CPython 3.14 CPython 3.14 Android API level 24+ ARM64 v8a Details for luvatrix-0.2.11-cp314-cp314-android_24_arm64_v8a.whl

Total release size: 4.0 MB

Release files / luvatrix-0.2.11.tar.gz

Download URL luvatrix-0.2.11.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
82fb099225a2c102af1c3d702ac78139a22355f1af62140717ff95597137f44c
BLAKE2b-256 checksum
How to use checksums
d34d18c070424e324a5095fd408976e0ccb11e7aa944d384683300d4149ff2a3
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 6, 2026.

Transparency log

Release files / luvatrix-0.2.11-py3-none-any.whl

Download URL luvatrix-0.2.11-py3-none-any.whl
Size 947.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b07c5acde9fde457097bd28bcd64282a3c34c9e88822bb750f6863689bdbc835
BLAKE2b-256 checksum
How to use checksums
a8ca0cdbd5dc14da223c8c4168987c4c96353d6a2de26a92e8aee4f78883708f
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 6, 2026.

Transparency log

Release files / luvatrix-0.2.11-cp314-cp314-android_24_x86_64.whl

Download URL luvatrix-0.2.11-cp314-cp314-android_24_x86_64.whl
Size 1.0 MB
Tags Android API level 24+ x86-64 CPython 3.14
SHA-256 checksum
How to use checksums
c4c5a351e8658f12f1e33b32b3b43678b17d865e93868f5daf7593cfe36c08a6
BLAKE2b-256 checksum
How to use checksums
f6aa52f6c44468e9d79de23ea7e00583ddf071aecc16e3da511cb087ac522d80
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 6, 2026.

Transparency log

Release files / luvatrix-0.2.11-cp314-cp314-android_24_arm64_v8a.whl

Download URL luvatrix-0.2.11-cp314-cp314-android_24_arm64_v8a.whl
Size 1.0 MB
Tags Android API level 24+ ARM64 v8a CPython 3.14
SHA-256 checksum
How to use checksums
85d54dd3a5d68e6dddeeb080d464ca7b5968e35b61f2732782e6a83dd31355a4
BLAKE2b-256 checksum
How to use checksums
81ddf2e17c6d779d38478204b1eff72e0fd2c69d755b1dfdfeee5a3f89d45774
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 6, 2026.

Transparency log

Security for luvatrix 0.2.11

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 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for luvatrix-0.2.11.tar.gz

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 6, 2026.

Transparency log

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