Skip to content

Set Pyodide 314.0.0a1 as a development version#6683

Open
ryanking13 wants to merge 1 commit intomainfrom
gyeongjae/cleanup-314
Open

Set Pyodide 314.0.0a1 as a development version#6683
ryanking13 wants to merge 1 commit intomainfrom
gyeongjae/cleanup-314

Conversation

@ryanking13
Copy link
Copy Markdown
Contributor

Updates the development Python version of Python workers to 3.14 (Pyodide 314.0.0a1).

The Pyodide version is not finalized yet, but releasing this with experimental flag would be helpful for us to debug issues with the new Python version.

@ryanking13 ryanking13 requested review from a team as code owners April 28, 2026 08:53
@ryanking13 ryanking13 force-pushed the gyeongjae/cleanup-314 branch from 4c5f677 to 166a5fb Compare April 28, 2026 08:54
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Bonk, and I've done a quick review of your PR.

This PR adds Pyodide 314.0.0a1 as the new development Python version (3.14), updating the build system, TypeScript pool setup, C++ server code, and tests to support the new version.

Findings (ranked by severity):

  1. [MEDIUM] build/python_metadata.bzl:214 — vendored test packages for 314.0.0a1 (Python 3.14.2) reuse abi "3.13" with identical hashes to 0.28.2 entries. If Python 3.14 breaks C-ABI compatibility with 3.13, these packages won't work. Intentional reuse for testing?

  2. [MEDIUM] src/workerd/server/server.c++:5836 — hardcoded version allowlist for package preloading is fragile; every new Pyodide version requires updating this check.

  3. [LOW] src/pyodide/internal/const.ts:8 — naming inconsistency: V314_0_0 omits the a1 suffix, unlike V0_26_0a2 which includes a2.

  4. [LOW] src/workerd/api/pyodide/setup-emscripten.c++:25-28 — the rejected-promise error log is helpful for debugging, but the unconditional KJ_ASSERT(FULFILLED) on line 31 will crash immediately after. Consider including the rejection reason in the assert message so it survives in crash logs.


This review was generated by an AI assistant and may contain inaccuracies.

Comment thread build/python_metadata.bzl
Comment thread src/workerd/server/server.c++
Comment thread src/pyodide/internal/const.ts Outdated
Comment thread src/workerd/api/pyodide/setup-emscripten.c++ Outdated
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 28, 2026

Review posted successfully on PR #6683. Here's a summary of the findings:

  1. [MEDIUM] Vendored test packages for 314.0.0a1 (Python 3.14.2) reuse abi: "3.13" with identical hashes to the 0.28.2 entries -- worth confirming this is intentional.

  2. [MEDIUM] Hardcoded version allowlist in server.c++ for package preloading is fragile -- suggested inverting the check to use the packages field presence instead.

  3. [LOW] Naming inconsistency: V314_0_0 drops the a1 suffix unlike V0_26_0a2 -- suggested V314_0_0a1 for consistency.

  4. [LOW] The rejected-promise debug logging in setup-emscripten.c++ is followed by an unconditional KJ_ASSERT(FULFILLED) -- suggested using KJ_FAIL_ASSERT to combine the error message and crash into one call.

No security issues, backward compatibility violations, or blocking problems found. The change is well-structured with proper version gating, test skips for features not yet supported, and the experimental flag is appropriately used.

github run

@github-actions
Copy link
Copy Markdown

The generated output of @cloudflare/workers-types has been changed by this PR. If this is intentional, run just generate-types to update the snapshot. Alternatively, you can download the full generated types:

Full Type Diff

Comment thread src/pyodide/internal/pool/sentinel.ts
Comment thread src/pyodide/internal/pool/emscriptenSetup.ts Outdated
Comment on lines +18 to +22
// directories in `pyodideRootDir` and find one that starts with a 0 or 3
const dir = readdirSync(pyodideRootDir).filter(
(x) =>
// Support both 0.x and 314.x versions
x.startsWith('0') || x.startsWith('3')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should figure out now how to get bazel to pass the version into the build. Maybe just write it into a file with a write_file() step and then read it with fs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I guess claude can figure out how to do it.

if (
version === PyodideVersion.V0_26_0a2 ||
version === PyodideVersion.V314_0_0
) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better fix this before we release a real version.

Copy link
Copy Markdown
Contributor Author

@ryanking13 ryanking13 Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a working PR upstream?

Comment thread src/pyodide/helpers.bzl Outdated
Comment on lines +169 to +185
@@ -176,6 +177,12 @@ _REPLACEMENTS = [
"globalThis._createPyodideModule = _createPyodideModule;",
"",
],
# for 314 or later, pyodide.asm.mjs is es6 module
[
"export default _createPyodideModule;",
# still expose _createPyodideModule for compatibility (import { _createPyodideModule })
_PRELUDE + "export default _createPyodideModule; export { _createPyodideModule };",
],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the appropriate changes in the function conditionally on the version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, right. Let's do that

Comment thread src/pyodide/helpers.bzl Outdated
Comment thread src/workerd/api/pyodide/pyodide.c++ Outdated
Comment thread src/workerd/server/tests/python/BUILD.bazel Outdated
@ryanking13 ryanking13 force-pushed the gyeongjae/cleanup-314 branch 2 times, most recently from 16b3029 to 90a8e03 Compare April 29, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants