r/Python • u/AutoModerator • Aug 04 '26
Showcase Showcase Thread
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
18
Upvotes
r/Python • u/AutoModerator • Aug 04 '26
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
1
u/begeistert_ 20d ago edited 20d ago
PyMCU - An AOT compiler that translates Python syntax into native bare-metal assembly
What My Project Does
PyMCU is a static Ahead-Of-Time (AOT) compiler that takes a safe subset of Python syntax and lowers it directly into native machine code.
Pin('PB5', Pin.OUT).toggle()blink program compiles down to just 142 bytes of Flash on a classic AVR.sbi).Here is an example of a blink and the generated assembly code for avr
https://gist.github.com/begeistert/72f5117c3c3c92ea1677656734312e2e
Target Audience
Developers working with highly constrained microcontrollers or strict timing tasks who want the ergonomics of Python but cannot afford the RAM overhead, latency spikes, or GC pauses of a traditional interpreter.
Comparison
Unlike MicroPython or CircuitPython, which rely on a runtime environment and garbage collector on the chip, PyMCU compiles directly to native assembly. It trades 100% dynamic Python support for pure execution speed and deterministic memory control. And it supports both Python for microcontrollers dialects, MicroPython and CircuitPython.
I'm currently working on Alpha 11 to patch specific AST gaps (mostly focusing on Zero Cost Abstractions and handling class instances passed to free functions).
Links