Luvatrix runtime and plotting toolkit
Project description
Luvatrix
Custom app protocol + custom rendering protocol runtime in Python.
Current Focus
Phase 1 is a macOS-first OS-level renderer:
- Window Matrix protocol (
H x W x 4RGBA255, PyTorch) - Vulkan presentation loop (
init -> loop -> stop) - HDI thread + Sensor manager thread
- In-process app protocol (
app.toml+ Python entrypoint)
Planning Document
See planning.md for the integrated Phase 1 spec and visual TLDR protocol models.
Repository Layout
- Core engine/runtime source lives in
luvatrix_core/. - In-repo UI contracts/components live in
luvatrix_ui/(text/,controls/,style/).
luvatrix_ui (In-Repo, v0)
luvatrix_ui is a first-party in-repo UI layer with explicit, future-extractable boundaries.
Current v0 surface:
TextRenderer+ text command/style contracts inluvatrix_ui/text/renderer.py.SVGRenderer+SVGComponentcontracts inluvatrix_ui/controls/svg_renderer.pyandluvatrix_ui/controls/svg_component.py.ButtonModelstate machine inluvatrix_ui/controls/button.py:idle,hover,press_down,press_hold,disabled.ThemeTokens+ validation/default merging inluvatrix_ui/style/theme.py.
Runtime-side compiler:
MatrixUIFrameRendererinluvatrix_core/core/ui_frame_renderer.pycompiles first-party component batches (including SVG) into matrix frame tensors forWriteBatchsubmission.
Interaction model:
- Consumes standardized HDI
pressphases (down,hold_start,hold_tick,up,cancel, etc.). - Keeps runtime/platform internals out of
luvatrix_ui; integrations should adapt events/renderers at the boundary.
See:
docs/ui_component_protocol.mdfor component contractsdocs/app_protocol.mdfor runtime contractdocs/json_ui_compiler.mdfor JSON page/lottie-oriented compiler design
macOS Visualizer Examples
Run stretch mode:
uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
Run preserve-aspect mode (black bars when needed):
uv run --python 3.14 python examples/macos_visualizer/preserve_aspect_mode.py
Run the full interactive suite app-protocol example (runs until window closes):
uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect stretch
uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect preserve
Force experimental Vulkan path:
LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN=1 uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
Force fallback layer-blit path:
unset LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN
uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
Quick Vulkan environment probe (no window):
uv run --python 3.14 python examples/macos_visualizer/vulkan_probe.py
App Protocol Example
Minimal input + sensor logger app:
uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py --simulate-hdi --simulate-sensors
Choose which sensors to log:
uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
--simulate-hdi \
--sensor thermal.temperature \
--sensor power.voltage_current
Additional available sensor metadata types:
sensor.motion, camera.device, microphone.device, speaker.device.
Open a macOS logger window and report real mouse hover coordinates (window-relative only, gated by active/focused window):
uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
--open-window \
--sensor thermal.temperature \
--sensor power.voltage_current
Notes:
--simulate-hdiintentionally emits synthetic keyboard events (key='a') for test visibility.- With
--open-windowand without--simulate-hdi, logger emits real window-gated mouse and keyboard input.
Unified Runtime CLI
App manifests can now include optional platform_support and [[variants]] blocks so runtime picks only the host-compatible variant entrypoint/module root.
Run any app protocol folder (app.toml + entrypoint) headless:
uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --ticks 300
Run it with macOS window rendering:
uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render macos --width 640 --height 360
Use real macOS sensor providers:
uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --sensor-backend macos
Enable runtime energy safety monitoring (throttles on warn, can enforce shutdown on sustained critical telemetry):
uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
--sensor-backend macos \
--energy-safety monitor
Enforce shutdown instead of monitor-only mode:
uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
--sensor-backend macos \
--energy-safety enforce \
--energy-critical-streak 3
Persist audit events to SQLite or JSONL:
uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-sqlite ./.luvatrix/audit.db
uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-jsonl ./.luvatrix/audit.jsonl
With the logger example, you can explicitly include motion:
uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
--open-window \
--sensor sensor.motion \
--sensor thermal.temperature \
--simulate-sensors
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file luvatrix-0.1.1.tar.gz.
File metadata
- Download URL: luvatrix-0.1.1.tar.gz
- Upload date:
- Size: 119.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6ec539720d1e0b098832c3ffe88a87ff957f151d0a3330419f7a4b1a3307e87
|
|
| MD5 |
aa9172f95bb7242ee3b1e7c24c0afb73
|
|
| BLAKE2b-256 |
69c220831fa0c00ddc10e217cf6b657abca1eb7c993e9ce892ed6b9b2cad57e3
|
File details
Details for the file luvatrix-0.1.1-py3-none-any.whl.
File metadata
- Download URL: luvatrix-0.1.1-py3-none-any.whl
- Upload date:
- Size: 109.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
302a3cd7bbfed4c64fb800bca63aa7dbb19b02f3e8fa458660c0df71f5f6346b
|
|
| MD5 |
71edafb327bfbde96f33d480170dc224
|
|
| BLAKE2b-256 |
daf79b95e0257efd8c9f262f36053b6e5517b96681b4a59ebb432c5f6fe0c924
|