PyO3 / PyO3/pyo3

MicroPython + PyO3 + `#![no_std]` - call for participation

Open
#3,510 3 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help-wanted
Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

This is an idea born out of a conversation I had earlier today at EuroRust.

Rust has a lot of success in the embedded space. There is also MicroPython to bring Python to these tiny devices (useful for certain applications). This begs the question, can PyO3 support MicroPython, should it, and who would benefit from it?

If you think the answer is that PyO3 should support MicroPython and you'd be interested in making it happen, please get involved! I think before we definitely commit to adding support to PyO3 we'd need to understand how much complexity it would add for us as maintainers, what features we would be able to support, and how we can test it in CI.

Some observations:

  • It looks like MicroPython has a completely different C API, with unique restrictions. See https://docs.micropython.org/en/latest/develop/natmod.html. If it makes sense, we could write a shim in pyo3-ffi to keep the complexity there, but I haven't looked in detail at the API, maybe it's too different.
  • It looks like packaging for MicroPython is completely different to PyPI wheel packaging (again see the above link). Probably maturin would need to consider adding some support.
  • #![no_std] is probably useful for these targets. PyO3 could add a #![no_std] feature regardless of whether we decide to accept MicroPython support. I don't think it would be too bad, just needs someone who wants it to investigate it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MicroPython's natmod documentation and compare its C API and restrictions with the interfaces exposed through pyo3-ffi. Investigate whether a shim, #![no_std] support, maturin packaging changes, and CI coverage are feasible; done means documenting a concrete scope, supported features, complexity, and testing approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
embedded-iot, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.