Skip to content

Commit

Permalink
Use python packages date from compat date.
Browse files Browse the repository at this point in the history
  • Loading branch information
dom96 committed Jan 10, 2025
1 parent c45a1bc commit 461276d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/workerd/api/pyodide/pyodide.c++
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@ kj::Array<kj::StringPtr> ArtifactBundler::getSnapshotImports() {
return result.releaseAsArray();
}

jsg::Ref<PyodideMetadataReader> makePyodideMetadataReader(
Worker::Reader conf, const PythonConfig& pythonConfig) {
jsg::Ref<PyodideMetadataReader> makePyodideMetadataReader(Worker::Reader conf,
const PythonConfig& pythonConfig,
PythonSnapshotRelease::Reader pythonRelease) {
auto modules = conf.getModules();
auto mainModule = kj::str(modules.begin()->getName());
int numFiles = 0;
Expand Down Expand Up @@ -451,13 +452,14 @@ jsg::Ref<PyodideMetadataReader> makePyodideMetadataReader(
bool createSnapshot = pythonConfig.createSnapshot;
bool createBaselineSnapshot = pythonConfig.createBaselineSnapshot;
bool snapshotToDisk = createSnapshot || createBaselineSnapshot;

// clang-format off
return jsg::alloc<PyodideMetadataReader>(
kj::mv(mainModule),
names.finish(),
contents.finish(),
requirements.finish(),
kj::str("20240829.4"), // TODO: hardcoded version
kj::str(pythonRelease.getPackages()),
true /* isWorkerd */,
false /* isTracing */,
snapshotToDisk,
Expand Down
5 changes: 3 additions & 2 deletions src/workerd/api/pyodide/pyodide.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ class SetupEmscripten: public jsg::Object {

using Worker = server::config::Worker;

jsg::Ref<PyodideMetadataReader> makePyodideMetadataReader(
Worker::Reader conf, const PythonConfig& pythonConfig);
jsg::Ref<PyodideMetadataReader> makePyodideMetadataReader(Worker::Reader conf,
const PythonConfig& pythonConfig,
PythonSnapshotRelease::Reader pythonRelease);

bool hasPythonModules(capnp::List<server::config::Worker::Module>::Reader modules);

Expand Down
4 changes: 2 additions & 2 deletions src/workerd/io/compatibility-date.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ struct CompatibilityFlags @0x8f8c1b68151b6cef {
pythonWorkers @43 :Bool
$compatEnableFlag("python_workers")
$pythonSnapshotRelease(pyodide = "0.26.0a2", pyodideRevision = "2024-03-01",
packages = "2024-03-01", backport = 13,
packages = "20240829.4", backport = 13,
baselineSnapshotHash = "d13ce2f4a0ade2e09047b469874dacf4d071ed3558fec4c26f8d0b99d95f77b5")
$impliedByAfterDate(name = "pythonWorkersDevPyodide", date = "2000-01-01");
# Enables Python Workers. Access to this flag is not restricted, instead bundles containing
Expand Down Expand Up @@ -583,7 +583,7 @@ struct CompatibilityFlags @0x8f8c1b68151b6cef {
pythonWorkersDevPyodide @58 :Bool
$compatEnableFlag("python_workers_development")
$pythonSnapshotRelease(pyodide = "dev", pyodideRevision = "dev",
packages = "2024-03-01", backport = 0,
packages = "20240829.4", backport = 0,
baselineSnapshotHash = "92859211804cd350f9e14010afad86e584bdd017dc7acfd94709a87f3220afae")
$experimental;
# Enables Python Workers and uses the bundle from the Pyodide source directory directly. For testing only.
Expand Down
3 changes: 2 additions & 1 deletion src/workerd/server/workerd-api.c++
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ void WorkerdApi::compileModules(jsg::Lock& lockParam,

// Inject metadata that the entrypoint module will read.
modules->addBuiltinModule("pyodide-internal:runtime-generated/metadata",
makePyodideMetadataReader(conf, impl->pythonConfig), jsg::ModuleRegistry::Type::INTERNAL);
makePyodideMetadataReader(conf, impl->pythonConfig), jsg::ModuleRegistry::Type::INTERNAL,
pythonRelease);

// Inject packages tar file
if (featureFlags.getPythonExternalPackages()) {
Expand Down

0 comments on commit 461276d

Please sign in to comment.