Vendor CPython stdlib modules as Python source (#1275, step 1)
Merged
R3
12d ago+6643+6643+0123456789012345678901234567890123456789-1050-1050-0123456789012345678901234567890123456789
First step of #1275: the §2 vendoring pipeline, with three modules that load today.
crates/monty/stdlib/vendor.tomlpins CPythonv3.14.10and lists theLib/files to vendor.make vendor-stdlibdownloads them and CPython'sLICENSE, appliespatches/*.patchin order (git apply, no fuzz), and generatescrates/monty/src/modules/bundled/sources.rs.make check-stdlib(CI) fails on any drift.scripts/vendor_stdlib.py --make-patch NAME --reason '...'saves edits toLib/as a patch. A patch must start with its reason and may only touch listed files.- An import finds a vendored module after the native
StandardLibmodules and before the host (module_finder.rs). It runs like a module from a file: compiled per session, cached by name, no OS call. - Vendors
colorsysunmodified.keywordandstatget one patch each, to work around Monty gaps: bound-method access on builtins, andfrom m import *. make stdlib-candidatesruns each #1275 candidate module throughmontyand groups them by first blocker. Today, 23 modules are blocked by inheritance, 9 bydel, 5 by relative imports (including all ofunittest), 5 byfrom m import *and 5 by method decorators. It runs the release binary: debug builds cap source nesting at 30 levels (release: 200), which real stdlib code exceeds.- Divergences are in
limitations/modules.mdunder "Vendored CPython modules".
Not included: packages with relative imports, a shared compile cache, and the remaining §2 items.