Repository navigation
feat(cpython): xz snapshot, preload urllib.request and parsers, fix doctest - #2573
Merged
Merged
Conversation
…octest The CPython snapshot ships xz-compressed (4.99 MB, was ~6.7 MB gzip), decoded by lzma-rs in build.rs. The room goes to preloading urllib.request (http.client, email), tomllib, configparser and xml.etree.ElementTree, whose imports drop from 0.1-0.47 s per call to ~0. A pdb stand-in makes doctest importable; mailbox is dropped. Claude-Session: https://claude.ai/code/session_01Ke1iW2hQi9VXioZi1avPaW
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 5183d83 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 04:24 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
artifacts/python.wasm.xz, 4.99 MB) instead of gzip (~6.7 MB).build.rsdecodes it withlzma-rs, a pure-Rust build-only dependency. Runtime is unchanged.urllib.request(withhttp.clientandemail),tomllib,configparserandxml.etree.ElementTreein the snapshot. Importing them now costs nothing per call.doctestworks again: it importedpdb, which is not shipped. A smallpdbstand-in now covers it, andbreakpoint()prints a notice and continues.mailboxis no longer shipped.Why
The CPython crate was 10.25 MB, 236 KB under the crates.io 10 MiB cap. That cap decided what could be preloaded, so common stdlib imports still cost 0.1-0.47 s on every call.
Before / After
bashkit-cpython-wasm.crateimport urllib.request(per call)import configparser/tomllib/xml.etree.ElementTreepython_call/cpython/printdoctest.testmod()ModuleNotFoundError: No module named 'pdb'TestResults(failed=0, attempted=1)Build cost: decoding the snapshot takes ~2.5 s in a debug build script, measured with lzma-rs 0.3.
Risk
bashkit-cpython-wasmnow needslzma-rs(pluscrcandcrc-catalog). These are exempted in cargo-vet; the licenses are MIT/Apache.xzon the build host.Checklist
doctest_works_and_breakpoint_continues;stdlib_is_bytecode_onlynow checks thatmailboxandbdbare absent.Generated by Claude Code