Would host-generated dataclass metadata fit micropython-lib? #20009
Replies: 1 comment
|
In Because build-time code generation tools and host-side AST extraction scripts operate in host CPython environments rather than on target chips, maintainers generally prefer keeping them in standalone PyPI packages or external developer tooling repos rather than the core That said, if your extraction workflow produces clean, optimized runtime schemas that improve memory efficiency or execution speed of dataclasses on constrained microcontrollers, submitting enhancements to the runtime |
Uh oh!
There was an error while loading. Please reload this page.
I maintain Dungeon Drifters, which shares model definitions between CPython and MicroPython. An AI-assisted extraction audit recommended extracting the game’s dataclass tooling. I published portable-dataclass-mpy so people could use and evaluate it independently of the game.
A CPython tool generates field metadata at build time. A small module reads it on stock MicroPython and supports a subset of
dataclasses, including defaults, default factories, equality, and frozen instances. The tradeoff is that you need to regenerate the metadata when model definitions change.I shared the package in the earlier dataclasses discussion.
Would this approach fit
micropython-lib? If so, would a maintainer be willing to review a focused PR, and what would you want it to demonstrate?All reactions