PyDevices / lv_bindings

One LVGL C API. Three Python bindings.

lv_bindings parses LVGL's C headers and generates native bindings for MicroPython, CircuitPython, and CPython from a single source of truth — so import lvgl means the same thing everywhere.

Source on GitHub PyDevices

What it generates

One generator, three targets

MicroPython

generated/lvgl_micropython.c — consumed by lv_micropython_cmod.

CircuitPython

generated/lvgl_circuitpython.{c,h} — consumed by lv_circuitpython_mod.

CPython

generated/lvgl_python.c — auto-synced into lv_cpython_mod on push to main.

Regenerate after changes

After editing lvgl/, lv_conf.h, or binding/
git clone https://github.com/PyDevices/lv_bindings.git
cd lv_bindings
git submodule update --init lvgl

python3 -m venv .venv
.venv/bin/pip install -r requirements.txt

./regenerate_lvmp.sh   # MicroPython  -> lvgl_micropython.c
./regenerate_lvcp.sh   # CircuitPython -> lvgl_circuitpython.c/.h
./regenerate_lvpy.sh   # CPython       -> lvgl_python.c
./regenerate_all.sh    # all three, plus commit + tag

./scripts/verify_bindings.sh   # regen + regression checks

Related