From 46a41f121c838d420129338daa5f50d135c78729 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Thu, 22 Jun 2023 18:06:39 +0200 Subject: [PATCH 1/2] Add Pyodide lockFileURL option --- packages/pyodide-kernel/src/tokens.ts | 5 +++++ packages/pyodide-kernel/src/worker.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/pyodide-kernel/src/tokens.ts b/packages/pyodide-kernel/src/tokens.ts index 13ace73f..2da75ab4 100644 --- a/packages/pyodide-kernel/src/tokens.ts +++ b/packages/pyodide-kernel/src/tokens.ts @@ -47,6 +47,11 @@ export namespace IPyodideWorkerKernel { */ indexUrl: string; + /** + * The URL from which Pyodide will load the pyodide-lock.json file + */ + pyodideLockFileURL: string; + /** * The URL of the `piplite` wheel for bootstrapping. */ diff --git a/packages/pyodide-kernel/src/worker.ts b/packages/pyodide-kernel/src/worker.ts index aaf3db49..1af54997 100644 --- a/packages/pyodide-kernel/src/worker.ts +++ b/packages/pyodide-kernel/src/worker.ts @@ -38,7 +38,7 @@ export class PyodideRemoteKernel { } protected async initRuntime(options: IPyodideWorkerKernel.IOptions): Promise { - const { pyodideUrl, indexUrl } = options; + const { pyodideUrl, indexUrl, pyodidelockFileURL } = options; let loadPyodide: typeof Pyodide.loadPyodide; if (pyodideUrl.endsWith('.mjs')) { // note: this does not work at all in firefox @@ -50,7 +50,7 @@ export class PyodideRemoteKernel { importScripts(pyodideUrl); loadPyodide = (self as any).loadPyodide; } - this._pyodide = await loadPyodide({ indexURL: indexUrl }); + this._pyodide = await loadPyodide({ indexURL: indexUrl, lockFileURL: pyodidelockFileURL}); } protected async initPackageManager( From 21891fd120fab5d2bcefdb8fa0c8ae951056ffe0 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Thu, 22 Jun 2023 18:22:48 +0200 Subject: [PATCH 2/2] Fix typo --- packages/pyodide-kernel/src/worker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/pyodide-kernel/src/worker.ts b/packages/pyodide-kernel/src/worker.ts index 1af54997..2a33022e 100644 --- a/packages/pyodide-kernel/src/worker.ts +++ b/packages/pyodide-kernel/src/worker.ts @@ -38,7 +38,7 @@ export class PyodideRemoteKernel { } protected async initRuntime(options: IPyodideWorkerKernel.IOptions): Promise { - const { pyodideUrl, indexUrl, pyodidelockFileURL } = options; + const { pyodideUrl, indexUrl, pyodideLockFileURL } = options; let loadPyodide: typeof Pyodide.loadPyodide; if (pyodideUrl.endsWith('.mjs')) { // note: this does not work at all in firefox @@ -50,7 +50,7 @@ export class PyodideRemoteKernel { importScripts(pyodideUrl); loadPyodide = (self as any).loadPyodide; } - this._pyodide = await loadPyodide({ indexURL: indexUrl, lockFileURL: pyodidelockFileURL}); + this._pyodide = await loadPyodide({ indexURL: indexUrl, lockFileURL: pyodideLockFileURL}); } protected async initPackageManager(