Skip to content

Commit

Permalink
pre-install packages concurently
Browse files Browse the repository at this point in the history
I think that instead of doing N requests of await piplite.install,
we can do one request with all the required packages.

This seem to only affect 6 packages when adding logging:

     - ssl
     - sqlite3
     - ipykernel
     - comm
     - pyodide_kernel
     - ipython

I'm assuming it won't make that much of a difference.
  • Loading branch information
Carreau committed Jan 30, 2025
1 parent 7b32d56 commit b25361e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/pyodide-kernel/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export class PyodideRemoteKernel {
const scriptLines: string[] = [];

// use piplite for packages that weren't pre-loaded
for (const pkgName of toLoad) {
if (!preloaded.includes(pkgName)) {
scriptLines.push(`await piplite.install('${pkgName}', keep_going=True)`);
}
const packagesToInstall = toLoad.filter((pkgName) => !preloaded.includes(pkgName));
if (packagesToInstall.length > 0) {
const pack_list = JSON.stringify(packagesToInstall);
scriptLines.push(`await piplite.install(${pack_list}, keep_going=True)`);
}

// import the kernel
Expand Down

0 comments on commit b25361e

Please sign in to comment.