v0.1.0a4 (alpha 4)
Pre-release
Pre-release
PyMCU v0.1.0a4 — fourth alpha. A quality-and-finish release: the rough edges alpha 3 shipped with are gone, firmware got a lot smaller, and the documentation was rebuilt from the ground up at docs.pymcu.org.
Fixed — things that silently didn't work
pymcu flashnow works end to end on the Raspberry Pi Pico / Pico 2: builds pack afirmware.uf2, the driver picks the right artifact per target and dispatches to the backend's programmer (the legacy[tool.pymcu.programmer]section still works, with a deprecation warning).async/awaiton AVR actually waits:asyncio.ticks()now reads a real Timer0 microsecond clock (4 µs resolution). On PIC / RISC-V / ATtiny — which have no timebase yet —awaitis a clear compile error instead of an infinite hang.- Register writes that compiled to nothing:
REG = xon aptr[T]alias silently rebound the name (this had brokenTimer.set_compare,toneon the 32U4 and the servo helper in the stdlib itself). All fixed with.value, and the compiler now rejects the bare form with an error naming both correct spellings. - ARM critical sections: operand-less
asm()clobbers memory (LLVM could hoist loads acrosscpsid i), andenable/disable_interrupts()emit realcpsie/cpsidon RP2040/RP2350. pymcu newscaffolds the configflashactually reads and the real clock per board (Pico 125 MHz, Pico 2 150 MHz); MAX7219 strobes the configured chip-select; BMP280/NeoPixel fail honestly on unsupported targets.
Smaller firmware
- Region outlining: duplicated inline expansions with internal control flow now share one subroutine when it is provably safe (never across error-signaling or calibrated timing loops). The 60 AVR examples shrink 23% overall — FFI examples up to −74%, sensor-dashboard −53%.
- Constant-delay outlining: repeated
delay_msbusy loops share a subroutine per iteration count — lcd −51%, blink 56 → 44 bytes — with the delay guaranteed never shorter.
Language & tooling
- Tuple return annotations:
-> (uint8, uint16)and-> tuple[...]both parse, validate arity at the definition, the call site and every return, and size the result slots (fixes a silent width truncation). - New diagnostics: dict/set comprehensions, reflection (
getattr/eval/…), compat modules without their flavor enabled (the error tells you the exactstdlib = [...]line to add), and bare register assignment. - IDE surface:
pymcu boards --json,pymcu stubs(PEP 561 stub generation) andpymcu lint --json. py.typedships inpymcu-stdlib, andpymcu.types.ptrfinally documents its compiled semantics — access forms, the volatility guarantee, and address arithmetic — right where IDE hovers show it.- MicroPython compat grows the wireless flavors (
network,rp2,umqtt) as installable packages.
Documentation
docs.pymcu.org is a new site: 54 pages audited against the code, synced MicroPython | CircuitPython | native-HAL tabs on every runnable example, 8 language guides (generators, async, exceptions, f-strings, dicts, zero-cost classes, C interop, inline asm), full driver and peripheral references, and a troubleshooting page.
Quality
All suites green at release: 416 unit + 89 driver + 1063 AVR + 70 ARM + 81 PIC.
Companion releases: pymcu-avr v0.1.0a4 · pymcu-arm v0.1.0a4
Install: pip install --pre "pymcu-compiler[all]"