|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Cursor Cloud specific instructions |
| 4 | + |
| 5 | +This repo (`lv_cpython_mod`) builds a single native CPython C-extension module named |
| 6 | +`lvgl` (LVGL bindings, no MicroPython runtime). It is a library, not a long-running |
| 7 | +service — there is no dev server, database, or daemon. "Running" it means importing |
| 8 | +the compiled module and exercising the API. See `README.md` for the full build/usage |
| 9 | +reference. |
| 10 | + |
| 11 | +### Environment layout (set up by the update script) |
| 12 | +- Workspace venv: `/workspace/.venv` (editable install of the `lvgl` extension). |
| 13 | +- External sibling dependency: `/lv_bindings` (cloned from |
| 14 | + `https://github.com/PyDevices/lv_bindings`, with the `lvgl` git submodule). |
| 15 | + `setup.py` hardcodes this path as `<parent of repo>/lv_bindings` (here `/lv_bindings`). |
| 16 | + It is **not vendored** in this repo and lives outside `/workspace`. |
| 17 | +- Generator venv: `/lv_bindings/.venv` (has `pycparser==2.21`, used only to emit bindings). |
| 18 | +- Generated bindings: `/lv_bindings/generated/lvpy.c` (gitignored, ~3 MB). `setup.py` |
| 19 | + hard-fails if this file is missing. |
| 20 | + |
| 21 | +### Build / test / run (use the workspace venv) |
| 22 | +- Build (after any change to `lvpy_runtime.c`): `/workspace/.venv/bin/pip install -e .` |
| 23 | + (or incremental `/workspace/.venv/bin/python setup.py build_ext --inplace`). |
| 24 | +- Tests (smoke suite): `/workspace/.venv/bin/python test_lvgl_cpython.py`. |
| 25 | +- Quick check: `/workspace/.venv/bin/python -c "import lvgl as lv; lv.init(); lv.deinit(); print('ok')"`. |
| 26 | +- Lint: none configured (no flake8/ruff/black/CI). Nothing to run. |
| 27 | + |
| 28 | +### Non-obvious gotchas |
| 29 | +- Editable install does **not** auto-recompile C sources on import. After editing |
| 30 | + `lvpy_runtime.c`, you must rebuild (`pip install -e .` or `build_ext --inplace`). |
| 31 | +- After editing anything that changes the generated surface, regenerate first: |
| 32 | + `cd /lv_bindings && ./regenerate_lvpy.sh` (requires `gcc -E` and the |
| 33 | + `/lv_bindings/.venv` with `pycparser==2.21`), then rebuild the extension. |
| 34 | +- The LVGL submodule clones via an `ssh://git@github.com` URL in `.gitmodules`; on this |
| 35 | + VM that resolves over HTTPS and succeeds. If a fresh clone ever fails on the submodule, |
| 36 | + re-run `git -C /lv_bindings submodule update --init` after rewriting the URL to HTTPS. |
| 37 | +- Headless: there is no display backend. Rendering is verified by registering a flush |
| 38 | + callback (`disp.set_flush_cb(...)`) and reading pixels via `color_p.__dereference__(n)`, |
| 39 | + exactly as `test_lvgl_cpython.py` does. |
0 commit comments