Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove code for Pyodide builtin bundle #3082

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/workerd/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 0 additions & 13 deletions src/workerd/api/pyodide/pyodide.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <workerd/util/autogate.h>

#include <pyodide/generated/pyodide_extra.capnp.h>
#include <pyodide/pyodide.capnp.h>

#include <capnp/serialize.h>
#include <kj/array.h>
Expand Down Expand Up @@ -425,31 +424,19 @@ bool hasPythonModules(capnp::List<server::config::Worker::Module>::Reader module
template <class Registry>
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<PackagesTarReader>(
"pyodide-internal:packages_tar_reader", workerd::jsg::ModuleRegistry::Type::INTERNAL);
}

kj::Own<jsg::modules::ModuleBundle> 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<jsg::modules::ModuleBundle> 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();
}

Expand Down
7 changes: 1 addition & 6 deletions src/workerd/io/compatibility-date.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
13 changes: 5 additions & 8 deletions src/workerd/server/workerd-api.c++
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/workerd/util/autogate.c++
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
1 change: 0 additions & 1 deletion src/workerd/util/autogate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};

Expand Down
Loading