Repository navigation
feat(cpython): drop low-use stdlib modules for agent scripts - #2582
Merged
Merged
Conversation
Agents run python3 for scripted logic (file processing, data transforms). Stop shipping unittest, doctest, profilers, compileall/zipapp, dbm/shelve, plistlib, wave, netrc, cmd, tty/pty and the bz2/lzma/zstd shims (no C codecs in the guest). Stdlib zip 3.58 -> 3.16 MB. Record the workload priority in knowledge.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 28de65e | Commit Preview URL Branch Preview URL |
Oct 07 2026, 06:06 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
The CPython guest no longer ships stdlib modules that agent scripts rarely use. These are dropped:
unittest,doctest,cProfile,profile,pstats,trace,tabnanny,pyclbr,modulefinder,pickletools,compileall,zipapp.dbm,shelve,plistlib,wave,netrc.cmd,rlcompleter,tty,pty.bz2,lzmaandcompression.zstdshims. Their C codecs were never built, so importing them already failed.concurrent.interpreters.gzip,zipfile(deflate),tarfile(plain/gzip),shutil,xml,csv,jsonandsqlite3are unchanged.breakpoint()still prints a notice and continues.The workload priority is now recorded in knowledge (
runtimes/cpython-wasm.md"Workload priority"). The main use is agents runningpython3for scripted logic such as processing a file. A low-use module needs a concrete agent use case before it is added back.Why
Every shipped module costs crate bytes, and those bytes are the budget for preloading modules that agents actually import.
Before / After
bashkit-cpython-wasm.crate: 8,642,486 → 8,216,210 bytes (cap 10 MiB).import unittest: Before, ~0.2 s per call. After,ModuleNotFoundError.print(1)per call: unchanged.Risk
ModuleNotFoundError. The full list is in L-CPY-009.Checklist
stdlib_is_bytecode_onlyasserts the drops and that gzip/zipfile/tarfile/shutil still import; doctest test replaced bybreakpoint_continues);cargo test --features cpython --test integration cpython: 113 passedGenerated by Claude Code