Repository navigation
Add Pyodide patch to remove redundant Python calls during the bootstrap - #8386
Conversation
There was a problem hiding this comment.
Superseded by the review of
a9900bcb.
This review, of feb3cdca
💬 Approved with comments — The patch logic is well guarded and matches the upstream change. The only note is an informational one about unrelated churn in MODULE.bazel.lock, including a transitive downgrade of hermetic_launcher.
Findings: 1 info (1 is an inline comment on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 1 info
Patch logic is sound; the lockfile has unrelated transitive dependency churn.
Recommendation: 💬 Optional Nits
- [INFO] MODULE.bazel.lock downgrades hermetic_launcher from 0.0.17 to 0.0.16 and adds other entries unrelated to the Pyodide bump. (
MODULE.bazel.lock:145)
View full review
- The
finalizeBootstrappatches are strict: each one hasexpected: 1, matches an exact literal or shape, and throws when the structure doesn't match. MODULE.bazel.lockalso changes things the Pyodide bump doesn't explain:hermetic_launchergoes from 0.0.17 to 0.0.16,aspect_tools_telemetrygains 0.5.2 entries, and new extension entries appear for protobuf, rules_android and rules_rust. This usually means the lock was regenerated against an oldermainor with a different Bazel or registry state.
✅ All other checks passed
🚀 Release: ✅ LGTM
Low risk: the dependency bundle bump has updated integrity hashes.
🔒 Security: ✅ LGTM
The bundle URL host is unchanged, and the new sha256 integrity hashes are pinned. The AST rewrite runs at build time on fixed matches and takes no untrusted input.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md concerns.
⚡ Performance: ✅ LGTM
Removing the Python source compilation and execution from finalizeBootstrap should reduce cold-start cost.
📝 Documentation: ✅ LGTM
No documentation concerns.
Reviewed commit: feb3cdca
hoodmane
left a comment
There was a problem hiding this comment.
Let's try to make the finalizeBootstrap: import _pyodide_core only when not restoring a snapshot patch shorter, it's a bit confusing this way.
feb3cdc to
a9900bc
Compare
There was a problem hiding this comment.
Superseded by the review of
22faa05f.
This review, of a9900bcb
✅ Approved — No issues found. Each new patch matches exactly one call and applies only to Pyodide 314.0.6, and the earlier MODULE.bazel.lock note no longer applies because that file is no longer changed.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
No issues found in src/pyodide/bundle/patch_pyodide_asm.ts.
- Matching:
isCallWithStringchecks the callee path, that there is exactly one argument, and that the argument is the expected string literal. Every patch setsexpected: 1. - Version gating: the patches apply only to version
314.0.6. arguments[0]: it is thesnapshotConfigparameter offinalizeBootstrap. The caller insrc/pyodide/internal/snapshot.tspassesLOADED_SNAPSHOT_META?.hiwire, which is set only when a snapshot is restored.[0, ""]: it has the same[status, cause]shape thatrawRunreturns (src/pyodide/internal/util.ts), so the error check that follows still passes.
📝 Documentation: ✅ LGTM
No documentation concerns.
Reviewed commit: a9900bcb
There was a problem hiding this comment.
Superseded by the review of
de6ec1ec.
This review, of 22faa05f
✅ Approved — No issues found. The metadata values agree with each other, and the Pyodide patches, unchanged since the last review, are each scoped to one call and only to version 314.0.6.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
No issues found.
- Metadata:
build/deps/pyodide.MODULE.bazelandbuild/python_metadata.bzlagree on backport12for Pyodide 314.0.6, and no_11reference is left in either file. patch_pyodide_asm.ts: unchanged since the last review. Each new patch matches exactly one call and is applied only for version314.0.6.
📝 Documentation: ✅ LGTM
No documentation concerns.
Reviewed commit: 22faa05f
22faa05 to
de6ec1e
Compare
There was a problem hiding this comment.
Superseded by the review of
4b738fd8.
This review, of de6ec1ec
✅ Approved — No issues found. The lockfile now has the backport-12 Pyodide bundle with the same name, URL and sha256 as the other build files, and the patches have not changed since the last review.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
- Bundle entry: in
MODULE.bazel.lock, thepyodide_314.0.6_2026-08-17_12.capnp.binname and URL matchbuild/deps/pyodide.MODULE.bazelandbuild/python_metadata.bzl. - sha256: the new hash is the same in the lockfile (both the
_12entry andpyodide_dev.capnp.bin) and inpython_metadata.bzl. - Repo list: the
use_repolist and the lockfile's repo-name list were updated together. - Transitive digest: the
bzlTransitiveDigestchange is what a change topyodide.bzlproduces. hermetic_launcher: the earlier note about its downgrade no longer applies. The lockfile diff no longer touches it, and the author explained it was an unsynced lockfile left over from an earlier pull request.- Patches:
src/pyodide/bundle/patch_pyodide_asm.tshas not changed since the last review.
📝 Documentation: ✅ LGTM
No documentation concerns.
Reviewed commit: de6ec1ec
de6ec1e to
4b738fd
Compare
There was a problem hiding this comment.
✅ Approved — No issues found. The lockfile now has the backport-12 Pyodide bundle with the same name, URL and sha256 as the other build files, and the patches have not changed since the last review.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
- Bundle entry: in
MODULE.bazel.lock, thepyodide_314.0.6_2026-08-17_12.capnp.binname and URL matchbuild/deps/pyodide.MODULE.bazelandbuild/python_metadata.bzl. - sha256: the new hash is the same in the lockfile (both the
_12entry andpyodide_dev.capnp.bin) and inpython_metadata.bzl. - Repo list: the
use_repolist and the lockfile's repo-name list were updated together. - Transitive digest: the
bzlTransitiveDigestchange is what a change topyodide.bzlproduces. hermetic_launcher: the earlier note about its downgrade no longer applies. The lockfile diff no longer touches it, and the author explained it was an unsynced lockfile left over from an earlier pull request.- Patches:
src/pyodide/bundle/patch_pyodide_asm.tshas not changed since the last review.
📝 Documentation: ✅ LGTM
No documentation concerns.
Reviewed commit: 4b738fd8 — same changes as de6ec1ec, so this is that commit's review (no new review was run; line numbers are as of de6ec1ec)
Adds a patch to apply upstream Pyodide PR to workerd (pyodide/pyodide#6534).
This removes expensive Python AST parse / Python function calls during the bootstrap to improve the cold start.