-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interpreters/python: Add Python's port to NuttX #2879
Conversation
e96c7ab
to
1494cbd
Compare
[Experimental Bot, please feedback here] This PR does not fully meet the NuttX requirements, although it presents a significant feature addition. Here's a breakdown: Summary: While the summary explains the what and why, it lacks details on how the Python integration works internally. More specifics on memory management, interaction with the OS, and the build process would be beneficial. The "Considerations" section highlights important limitations and to-dos, which is good, but some of these should be addressed before merging. Impact: The impact section is incomplete. While it mentions the target architecture, it needs to address all the points:
Testing: The testing section is insufficient.
Recommendations:
This PR has great potential but needs more work to meet NuttX's standards for completeness and maintainability. Addressing these points will make the integration more robust and easier for the community to adopt. |
Great, nice work! |
need add cmake? |
Yes! There is a long list of to-do, but I preferred to submit upstream because I need more hands working on it (and I think we can engage the NuttX community by doing that). NuttX would be one of the first RTOS supporting Python ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool! I'm in favor of making an early version available for testing and further development by the community. Should it be behind a "EXPERIMENTAL" config, to set the right expectations?
Yes, it makes total sense! |
Error for |
1494cbd
to
340a9aa
Compare
340a9aa
to
c813f15
Compare
I ran the CI locally (apache/nuttx#14601 (comment)) and it didn't fail. However, it may be related to an issue that I fixed at f064a19 (just sent along with this PR) |
This is awesome. |
The generation of `sys info.h` depends on evaluating whether Espressif's HAL exists in the arch folder. However, cloning the HAL itself happens in the `context` phase of the build, so it is necessary to wait for it to finish before proceeding to the evaluation in nxdiag. This is done by using the `depend` phase to generate the `sysinfo.h` file.
c813f15
to
51ca481
Compare
This is the NuttX's port of Python (cpython)! Initial support of Python includes building the Python's static library and the `python` (Programs/python.c) application. Python's modules are stored in `pyc` (byte-code file) and loaded as needed from flash.
51ca481
to
c4fac00
Compare
Summary
Say Hello to Python!
This is the NuttX's port of Python (CPython)!
Initial support of Python includes building the Python's static library and the
python
(Programs/python.c) application. Python's modules are stored inpyc
(byte-code file) and loaded as needed from flash.Considerations
Please note that this is the initial port of one of the most used programming languages for NuttX (and, maybe, for embedded RTOSes). There is a long list of To-Do to make it fully functional. NuttX is perhaps one of the best embedded RTOSes for working with Python due to its POSIX Compatibility and on-demand paging (https://nuttx.apache.org/docs/latest/components/paging.html#ondemandpaging). I hope this PR engages NuttX community to keep improving Python for use in embedded applications with NuttX.
Please consider that:
rv-virt
(RISC-V QEMU). That being said, itsinterpreters/python/config.site
andinterpreters/python/Setup.local
are somehow tied with the features enabled by the attached defconfig (Yes, I will submit a PR on https://github.com/apache/nuttx for it)pyc
modules are loaded from a ROMFS image at startup. Therefore, we need an application to mount it (that's themount_modules
role!).PYTHONHOME
andPYTHON_BASIC_REPL
environment variables.Impact
Provides initial support for Python on NuttX. Please note that it supports, initially, only the
rv-virt
(RISC-V QEMU) "board".Testing
Internal CI testing +
rv-virt:cpython
.Building
Create a defconfig file at
nuttx/boards/risc-v/qemu-rv/rv-virt/configs/cpython/defconfig
with the following content:Build it with:
Testing
Run it with RISC-V QEMU:
On NuttX:
Check the following record to run Python
(yes, you can copy the commands from there)