Skip to content
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

[FEATURE] Python on NuttX: known issues, "TO-DO" list, and general enhancements #2884

Open
4 of 6 tasks
tmedicci opened this issue Dec 9, 2024 · 4 comments
Open
4 of 6 tasks
Assignees

Comments

@tmedicci
Copy link
Contributor

tmedicci commented Dec 9, 2024

Is your feature request related to a problem? Please describe.

After #2879 was merged, it's time to make Python on NuttX fully usable!

This issue intends to discuss the next steps required to make it fully functional, including a "To-Do" list and any discussions on how it would evolve to support other architectures and platforms.

Initial Considerations

  1. Python for NuttX target initially the rv-virt (RISC-V QEMU). That being said, its interpreters/python/config.site and interpreters/python/Setup.local are somehow tied with the features enabled by the boards/risc-v/qemu-rv/rv-virt/configs/cpython/defconfig. Python for NuttX depends on CONFIG_EXPERIMENTAL!
  2. Python modules are stored in pyc (byte-code format) and are loaded from a ROMFS image at startup.
  3. Environment variables like PYTHONHOME and PYTHON_BASIC_REPL needs to be set accordingly.

Describe the solution you'd like

TO-DO list:

This is the list of the next steps to make Python's port fully functional (sorted by highest priority):

  • Provide a CMake-based build: currently we can only build it using Make.
  • Generate interpreters/python/Setup.local and interpreters/python/config.site dynamically according to the enabled configs. For instance: export ac_cv_func_pipe="yes" depends on CONFIG_PIPES being enabled.
  • Create a wrapper application to automate the 1) mounting the ROMFS image with the Python's modules, 2) setting the environment variables and 3) running the Program/python.c app.
  • Support Python's socket module. This is one of the most important modules to enable Python applications with POSIX-compatible sockets .

Known Issues

Describe alternatives you've considered

No response

Verification

  • I have verified before submitting the report.
@tmedicci tmedicci added the Type: Enhancement New feature or request label Dec 9, 2024
@tmedicci tmedicci self-assigned this Dec 9, 2024
@tmedicci tmedicci changed the title [FEATURE] Python on NuttX: "To-Do" list and general enhancements [FEATURE] Python on NuttX: Known Issues, "To-Do" list, and general enhancements Dec 9, 2024
@tmedicci tmedicci changed the title [FEATURE] Python on NuttX: Known Issues, "To-Do" list, and general enhancements [FEATURE] Python on NuttX: known issues, "TO-DO" list, and general enhancements Dec 9, 2024
@tmedicci
Copy link
Contributor Author

tmedicci commented Jan 7, 2025

Update: Python's socket module is now supported and Python on NuttX can run applications with POSIX-compatible sockets. Please check apache/nuttx#15457 and #2928 for examples.

@tmedicci
Copy link
Contributor Author

tmedicci commented Jan 8, 2025

Hi, I prepared an article with the technical details of the implementation in my blog. You can check it at:

https://tmedicci.github.io/articles/2025/01/08/python_on_nuttx.html

@tmedicci tmedicci pinned this issue Jan 31, 2025
@tmedicci
Copy link
Contributor Author

Just submitted a new PR (#2982) that solves two issues on TO-DO list:

  1. Generate interpreters/python/Setup.local and interpreters/python/config.site dynamically according to the enabled configs. For instance: export ac_cv_func_pipe="yes" depends on CONFIG_PIPES being enabled.
  2. Create a wrapper application to automate the 1) mounting the ROMFS image with the Python's modules, 2) setting the environment variables and 3) running the Program/python.c app.

@cederom cederom moved this to In Progress in Apache NuttX RTOS Jan 31, 2025
@cederom cederom added Area: Interpreters and removed Type: Enhancement New feature or request labels Jan 31, 2025
@tmedicci
Copy link
Contributor Author

tmedicci commented Mar 7, 2025

Just submitted the support for running Python on ESP32-S3: apache/nuttx#15955

Please check the following article for more detailed explanation and example: Running Python on ESP32-S3 with NuttX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

2 participants