Skip to content

Commit

Permalink
Add compatibility date for Pyodide 0.26.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Dec 24, 2024
1 parent 8620d14 commit 521fe8c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/workerd/io/compatibility-date.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,11 @@ struct CompatibilityFlags @0x8f8c1b68151b6cef {
tailWorkerUserSpans @69 :Bool
$compatEnableFlag("tail_worker_user_spans")
$experimental;

pythonWorkers20241218 @70 :Bool
$compatEnableFlag("python_workers_20241218")
$experimental
$pythonSnapshotRelease(pyodide = "0.26.4", pyodideRevision = "2024-12-18",
packages = "2024-12-18", backport = 0,
baselineSnapshotHash = "TODO");
}
6 changes: 5 additions & 1 deletion src/workerd/server/tests/python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ py_wd_test(
],
)

gen_import_tests(PYODIDE_IMPORTS_TO_TEST)
gen_import_tests(
PYODIDE_IMPORTS_TO_TEST,
# TODO: Micropip version mismatch for 0.26.4
pkg_python_versions = {"micropip": ["0.26.0a2", "development"]},
)
3 changes: 2 additions & 1 deletion src/workerd/server/tests/python/import_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def generate_wd_test_file(requirement):
return WD_FILE_TEMPLATE.format(requirement, requirement)

# to_test is a dictionary from library name to list of imports
def gen_import_tests(to_test):
def gen_import_tests(to_test, pkg_python_versions = {}):
for lib in to_test.keys():
prefix = "import/" + lib
worker_py_fname = prefix + "/worker.py"
Expand All @@ -52,6 +52,7 @@ def gen_import_tests(to_test):
name = prefix,
directory = lib,
src = wd_test_fname,
python_flags = pkg_python_versions.get(lib, "all"),
args = ["--experimental", "--pyodide-package-disk-cache-dir", "../all_pyodide_wheels"],
data = [worker_py_fname, "@all_pyodide_wheels//:whls"],
size = "enormous",
Expand Down
6 changes: 4 additions & 2 deletions src/workerd/server/tests/python/py_wd_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("//:build/wd_test.bzl", "wd_test")

FEATURE_FLAGS = {
"0.26.0a2": ["python_workers"],
"0.26.0a2": [],
"0.26.4": ["python_workers_20241218"],
"development": ["python_workers_development"],
}

Expand Down Expand Up @@ -37,7 +38,8 @@ def py_wd_test(
name_flag = name + "_" + python_flag
templated_src = name_flag.replace("/", "-") + "@template"
templated_src = "/".join(src.split("/")[:-1] + [templated_src])
feature_flags_txt = ",".join(['"{}"'.format(flag) for flag in FEATURE_FLAGS[python_flag]])
flags = FEATURE_FLAGS[python_flag] + ["python_workers"]
feature_flags_txt = ",".join(['"{}"'.format(flag) for flag in flags])
expand_template(
name = name_flag + "@rule",
out = templated_src,
Expand Down

0 comments on commit 521fe8c

Please sign in to comment.