I’ve been using the micropython stubs for 8.1 for a bit now, but recently changed to v9.
There are no stubs for v9 yet in the micropython-stubs collection:
https://micropython-stubs.readthedocs.io/en/main/packages.html
I do not quite understand how these stubs are created and if one can create them using the unix port?
The examples I see in the documentation rely on mpremote, which I cannot use on the unix port.
I do not know how to create them or even get started creating them, without reading dozens of documentations, just to piece together information that appears to be targeted mainly for specific hardware.
Ohhh that’s a tricky nut to crack right there. We started working on a way to do that. I am waiting for the PR to get merged and then I can begin the next steps of creating the stub files.
lvgl:master
← kdschlosser:gen_json
opened 04:24AM - 18 Feb 24 UTC
### Description of the feature or fix
adds a script that reads the LVGL heade… r files and generates JSON output for the entire LVGL API. complete with documentation for the various API features and also documentation on how to use the script.
### Notes
- Update the [Documentation](https://github.com/lvgl/lvgl/tree/master/docs) if needed.
- Add [Examples](https://github.com/lvgl/lvgl/tree/master/examples) if relevant.
- Add [Tests](https://github.com/lvgl/lvgl/blob/master/tests/README.md) if applicable.
- If you added new options to `lv_conf_template.h` run [lv_conf_internal_gen.py](https://github.com/lvgl/lvgl/blob/master/scripts/lv_conf_internal_gen.py) and update [Kconfig](https://github.com/lvgl/lvgl/blob/master/Kconfig).
- Run `scripts/code-format.py` ([astyle](http://astyle.sourceforge.net/install.html) version [v3.4.10](https://github.com/szepeviktor/astyle/releases/tag/v3.4.10) needs to be installed) and follow the [Code Conventions](https://docs.lvgl.io/master/CODING_STYLE.html).
- Mark the Pull request as [Draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request) while you are working on the first version, and mark is as _Ready_ when it's ready for review.
- When changes were requested, [re-request review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review) to notify the maintainers.
- Help us to review this Pull Request! Anyone can [approve or request changes](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/approving-a-pull-request-with-required-reviews).
That script read all of the LVGL header files and puts together a map of the entire LVGL API into JSON format. This includes all types and names as well as all of the documentation that is in LVGL for the API. Using that I can build the stub file pretty easily.
Looks promising, unfortunately the script doesn’t work for me on Linux yet.
Traceback (most recent call last):
File "/home/rini-debian/git-stash/lvgl/scripts/gen_json/gen_json.py", line 176, in run
p = subprocess.Popen(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gcc -std=c11 -E -Wno-incompatible-pointer-types -o "/tmp/tmphy6hnwgb.lvgl_json/lvgl.pp" -DLV_LVGL_H_INCLUDE_SIMPLE -DLV_CONF_INCLUDE_SIMPLE -DLV_USE_DEV_VERSION -DPYCPARSER -I"/tmp/tmphy6hnwgb.lvgl_json/fake_libc_include" -I"/tmp/tmphy6hnwgb.lvgl_json" -I"/home/rini-debian/git-stash/lvgl" "/tmp/tmphy6hnwgb.lvgl_json/lvgl/lvgl.h"'
Looking through your script will take me a bit, might be an issue on my end.
Here you go.
Download the file and remove the “.txt” extension
lvgl.pyi.txt (459.0 KB)
Many, many thanks!
I’ll keep an eye on the PR, surely is a helpful addon to the repository, even though I couldn’t get it running for now.
You should consider adding it to the micropython stubs collection, I surely am not the only person looking out for it.
I literally generated that last night. I have not checked the consistency of it and I am sure you will report anything that is not correct.