From eea50388f78787e3f5900e3065faac0126b104fa Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Fri, 8 Nov 2024 15:41:08 +0100 Subject: [PATCH] Remove code to for Pyodide builtin bundle Now that we've rolled out the code to use the external bundle, we don't need the builtin bundle anymore. --- src/workerd/api/BUILD.bazel | 1 - src/workerd/api/pyodide/pyodide.h | 13 ------------- src/workerd/io/compatibility-date.capnp | 7 +------ src/workerd/server/workerd-api.c++ | 13 +++++-------- src/workerd/util/autogate.c++ | 2 -- src/workerd/util/autogate.h | 1 - 6 files changed, 6 insertions(+), 31 deletions(-) diff --git a/src/workerd/api/BUILD.bazel b/src/workerd/api/BUILD.bazel index 719018cabbf..9cba4624afc 100644 --- a/src/workerd/api/BUILD.bazel +++ b/src/workerd/api/BUILD.bazel @@ -134,7 +134,6 @@ wd_cc_library( implementation_deps = ["//src/workerd/util:string-buffer"], visibility = ["//visibility:public"], deps = [ - "//src/pyodide", "//src/pyodide:pyodide_extra_capnp", "//src/workerd/io", "//src/workerd/jsg", diff --git a/src/workerd/api/pyodide/pyodide.h b/src/workerd/api/pyodide/pyodide.h index 6dde213bb6b..19e0e32c5a7 100644 --- a/src/workerd/api/pyodide/pyodide.h +++ b/src/workerd/api/pyodide/pyodide.h @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -425,10 +424,6 @@ bool hasPythonModules(capnp::List::Reader module template void registerPyodideModules(Registry& registry, auto featureFlags) { // We add `pyodide:` packages here including python-entrypoint-helper.js. - if (!featureFlags.getPythonExternalBundle() && - !util::Autogate::isEnabled(util::AutogateKey::PYTHON_EXTERNAL_BUNDLE)) { - registry.addBuiltinBundle(PYODIDE_BUNDLE, kj::none); - } registry.template addBuiltinModule( "pyodide-internal:packages_tar_reader", workerd::jsg::ModuleRegistry::Type::INTERNAL); } @@ -436,20 +431,12 @@ void registerPyodideModules(Registry& registry, auto featureFlags) { kj::Own getInternalPyodideModuleBundle(auto featureFlags) { jsg::modules::ModuleBundle::BuiltinBuilder builder( jsg::modules::ModuleBundle::BuiltinBuilder::Type::BUILTIN_ONLY); - if (!featureFlags.getPythonExternalBundle() && - !util::Autogate::isEnabled(util::AutogateKey::PYTHON_EXTERNAL_BUNDLE)) { - jsg::modules::ModuleBundle::getBuiltInBundleFromCapnp(builder, PYODIDE_BUNDLE); - } return builder.finish(); } kj::Own getExternalPyodideModuleBundle(auto featureFlags) { jsg::modules::ModuleBundle::BuiltinBuilder builder( jsg::modules::ModuleBundle::BuiltinBuilder::Type::BUILTIN); - if (!featureFlags.getPythonExternalBundle() && - !util::Autogate::isEnabled(util::AutogateKey::PYTHON_EXTERNAL_BUNDLE)) { - jsg::modules::ModuleBundle::getBuiltInBundleFromCapnp(builder, PYODIDE_BUNDLE); - } return builder.finish(); } diff --git a/src/workerd/io/compatibility-date.capnp b/src/workerd/io/compatibility-date.capnp index b0fa6b93736..f36f62796dd 100644 --- a/src/workerd/io/compatibility-date.capnp +++ b/src/workerd/io/compatibility-date.capnp @@ -623,13 +623,8 @@ struct CompatibilityFlags @0x8f8c1b68151b6cef { # compatibility flag we arrange to have such promise continuations scheduled to run # in the correct IoContext if it is still alive, or dropped on the floor with a warning # if the correct IoContext is not still alive. - pythonExternalBundle @63 :Bool - $compatEnableFlag("python_external_bundle") + obsolete63 @63 :Bool $experimental; - # Temporary flag to load Python from external capnproto bundle loaded at runtime. - # We plan to turn this on always quite soon. It would be an autogate but we need to test - # our logic both at upload time and at runtime, and this seemed like the easiest way to - # make sure we keep things in sync. setToStringTag @64 :Bool $compatEnableFlag("set_tostring_tag") diff --git a/src/workerd/server/workerd-api.c++ b/src/workerd/server/workerd-api.c++ index a0dcf2df17a..fbeba6d4019 100644 --- a/src/workerd/server/workerd-api.c++ +++ b/src/workerd/server/workerd-api.c++ @@ -536,14 +536,11 @@ void WorkerdApi::compileModules(jsg::Lock& lockParam, KJ_REQUIRE(featureFlags.getPythonWorkers(), "The python_workers compatibility flag is required to use Python."); // Inject Pyodide bundle - if (featureFlags.getPythonExternalBundle() || - util::Autogate::isEnabled(util::AutogateKey::PYTHON_EXTERNAL_BUNDLE)) { - auto pythonRelease = KJ_ASSERT_NONNULL(getPythonSnapshotRelease(featureFlags)); - auto version = getPythonBundleName(pythonRelease); - auto bundle = KJ_ASSERT_NONNULL( - fetchPyodideBundle(impl->pythonConfig, version), "Failed to get Pyodide bundle"); - modules->addBuiltinBundle(bundle, kj::none); - } + auto pythonRelease = KJ_ASSERT_NONNULL(getPythonSnapshotRelease(featureFlags)); + auto version = getPythonBundleName(pythonRelease); + auto bundle = KJ_ASSERT_NONNULL( + fetchPyodideBundle(impl->pythonConfig, version), "Failed to get Pyodide bundle"); + modules->addBuiltinBundle(bundle, kj::none); // Inject pyodide bootstrap module (TODO: load this from the capnproto bundle?) { auto mainModule = confModules.begin(); diff --git a/src/workerd/util/autogate.c++ b/src/workerd/util/autogate.c++ index 7d994c88697..79376ebbf1b 100644 --- a/src/workerd/util/autogate.c++ +++ b/src/workerd/util/autogate.c++ @@ -17,8 +17,6 @@ kj::StringPtr KJ_STRINGIFY(AutogateKey key) { switch (key) { case AutogateKey::TEST_WORKERD: return "test-workerd"_kj; - case AutogateKey::PYTHON_EXTERNAL_BUNDLE: - return "python-external-bundle"_kj; case AutogateKey::NumOfKeys: KJ_FAIL_ASSERT("NumOfKeys should not be used in getName"); } diff --git a/src/workerd/util/autogate.h b/src/workerd/util/autogate.h index d4d3b620077..fe934116c10 100644 --- a/src/workerd/util/autogate.h +++ b/src/workerd/util/autogate.h @@ -14,7 +14,6 @@ namespace workerd::util { // Workerd-specific list of autogate keys (can also be used in internal repo). enum class AutogateKey { TEST_WORKERD, - PYTHON_EXTERNAL_BUNDLE, NumOfKeys // Reserved for iteration. };