Commit 4537376
committed
gen/gen_mpy: Add Python stub file generation for IDE support.
Extends the LVGL bindings generator to automatically create Python stub
files (.pyi) that provide type hints and enable IDE autocompletion for
LVGL MicroPython bindings.
Features:
- Type mapping from C types to Python type hints
- Single stub file with all widgets, functions, enums, and constants
- Detailed documentation header with content statistics
The generated lvgl.pyi file includes 40+ widget classes, 300+ functions,
and comprehensive type information for better development experience.
Include C function names, location and description in Python stub docstrings.
The docstrings include a "C function: <name>" line before the
"Source: <file>:<line>" reference. For example:
- Python method `delete()` shows "C function: lv_obj_delete"
- Python method `add_flag()` shows "C function: lv_obj_add_flag"
Create a proper Python package structure for LVGL type stubs:
- Create stubs/pyproject.toml with setuptools-scm versioning
- Add stubs/lvgl-stubs/ package directory with __init__.py and py.typed
- Update gen_mpy.py to output stubs to package directory by default
- Add .gitignore to exclude generated .pyi files but include package structure
- Update README.md with comprehensive IDE support documentation
Signed-off-by: Andrew Leech <andrew@alelec.net>1 parent 44f70b1 commit 4537376
File tree
9 files changed
+886
-2
lines changed- gen
- stubs
- lvgl-stubs
9 files changed
+886
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
0 commit comments