The MicroPython 1.23 unix port as the Mech stand-in (2026-11-01, #222)
Question: can the unix port of the Core’s MicroPython (pyproject [tool.noggin], 1.23) run the Core’s real program
(eyes/boot.py, wifi.py, eyes.py as .mpy) as a CI process, and what must the stand-in stub? Sources: the MicroPython
source at tag v1.23.0 (MP/ = https://github.com/micropython/micropython/blob/v1.23.0/), built and probed on macOS
(Apple clang) 2026-11-01.
make -C ports/unix submodules, thenmake -C ports/unix; the binary isports/unix/build-standard/micropython(the default variant,MP/ports/unix/Makefile). WithMICROPY_PY_FFI=0 MICROPY_PY_BTREE=0 MICROPY_PY_SSL=0it needs no libffi or mbedtls (MP/ports/unix/Makefilelines 118-187);FROZEN_MANIFEST=freezes nothing, so it needs no mpy-cross build either. Clone, submodules and build took about 10 s on 10 cores.- Newer compilers warn where v1.23.0 compiled clean (Apple clang:
-Wgnu-folding-constantin py/emitnative.c,-Wunterminated-string-initializationin extmod/moductypes.c) and the port builds with-Werror:CFLAGS_EXTRA=-Wno-errorbuilds it. - It reports
sys.implementation._mpy == 774and version (1, 23, 0), the Core’s (MP/py/persistentcode.hlines 37-38: MPY_VERSION 6, MPY_SUB_VERSION 3), so it loads the .mpy files mpy-cross 1.23 writes for the Core. - At about 10 s cold, a prebuilt binary would save nothing worth a second source to trust; it is not looked for.
- micropython-lib, pinned as the
lib/micropython-libsubmodule (50ed36f), carriespython-stdlib/hmac/hmac.py(metadata version 3.4.4, the packagemip install hmacgives the Core):hmac.new(key, msg, hashlib.sha256)agrees with CPython’s; it has nocompare_digest(eyes/wifi.py falls back to its XOR loop).
Behaviour that shapes the stubs
Section titled “Behaviour that shapes the stubs”- Import order: a non-extensible built-in first, then the filesystem along
sys.path, then an extensible built-in (MP/py/builtinimport.clines 393-411).machine,os,selectandsocketare extensible (MP_REGISTER_EXTENSIBLE_MODULEinMP/extmod/modmachine.c254,modos.c234,modselect.c674,MP/ports/unix/modsocket.c721), so amachine.pyorsocket.pyon the path wins; the shadowed built-in is still reachable asusocket(probed). The unix port has nonetwork. Its ownmachinehas only mem8/16/32, PinBase, Signal, idle, soft_reset, time_pulse_us: no PWM, Pin, Timer or reset. sys.pathis['', '.frozen', '~/.micropython/lib', '/usr/lib/micropython'], orMICROPYPATH’s colon-separated entries in place of the last two (MP/ports/unix/main.clines 555-557); the script’s own folder comes first.- The unix
sockettakes and returns rawsockaddrbytes, not(host, port)tuples:bind,connectandsendtocallmp_get_buffer_raiseon the address (MP/ports/unix/modsocket.clines 198, 228, 358), sobind(("0.0.0.0", p))raisesTypeError: object with buffer protocol required(probed);getaddrinfo(host, port)[0][-1]makes one. A non-blockingrecvfromwith nothing waiting raisesOSErrorEAGAIN, as wifi.py expects. _threadis on (MP/ports/unix/mpconfigport.mkline 15) andmicropython.scheduleruns a callback on the main thread, but throughmp_call_function_1_protected(MP/py/scheduler.cline 111): an exception it raises, evenSystemExit, is printed and swallowed (probed). So a stubmachine.resetcannot besys.exitwhen a Timer callback calls it;os.systemexists, andkill -TERM $PPIDfrom it ends the process from any thread.sys.exit(n)exits with status n (probed: 42) andSystemExitis aBaseException, outsideexcept Exception.time.ticks_ms,ticks_diffandsleep_msexist;select.pollregisterssys.stdin.
noggin v0.2.26-6-g09bf9b7 · 09bf9b7