From 6db2ba0c080cab3237d68e4adb5bd92edc57aa1c Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 31 Dec 2024 16:19:53 -0600 Subject: [PATCH 1/5] bump versions --- examples/jupyter-lite.json | 2 +- jupyterlite_pyodide_kernel/constants.py | 2 +- packages/pyodide-kernel-extension/schema/kernel.v0.schema.json | 2 +- packages/pyodide-kernel-extension/src/index.ts | 2 +- packages/pyodide-kernel/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/jupyter-lite.json b/examples/jupyter-lite.json index 438064bd..30dfe70c 100644 --- a/examples/jupyter-lite.json +++ b/examples/jupyter-lite.json @@ -6,7 +6,7 @@ "@jupyterlite/pyodide-kernel-extension:kernel": { "loadPyodideOptions": { "packages": ["matplotlib", "micropip", "numpy", "sqlite3", "ssl"], - "lockFileURL": "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide-lock.json?from-lite-config=1" + "lockFileURL": "https://cdn.jsdelivr.net/pyodide/v0.27.0/full/pyodide-lock.json?from-lite-config=1" } } } diff --git a/jupyterlite_pyodide_kernel/constants.py b/jupyterlite_pyodide_kernel/constants.py index fd6f5d67..d31ab02f 100644 --- a/jupyterlite_pyodide_kernel/constants.py +++ b/jupyterlite_pyodide_kernel/constants.py @@ -29,7 +29,7 @@ PYODIDE_URL_ENV_VAR = "JUPYTERLITE_PYODIDE_URL" #: probably only compatible with this version of pyodide -PYODIDE_VERSION = "0.26.4" +PYODIDE_VERSION = "0.27.0" #: the only kind of noarch wheel piplite understands NOARCH_WHL = "py3-none-any.whl" diff --git a/packages/pyodide-kernel-extension/schema/kernel.v0.schema.json b/packages/pyodide-kernel-extension/schema/kernel.v0.schema.json index 7963a4be..f98a6883 100644 --- a/packages/pyodide-kernel-extension/schema/kernel.v0.schema.json +++ b/packages/pyodide-kernel-extension/schema/kernel.v0.schema.json @@ -8,7 +8,7 @@ "pyodideUrl": { "description": "The path to the main pyodide.js entry point", "type": "string", - "default": "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide.js", + "default": "https://cdn.jsdelivr.net/pyodide/v0.27.0/full/pyodide.js", "format": "uri" }, "disablePyPIFallback": { diff --git a/packages/pyodide-kernel-extension/src/index.ts b/packages/pyodide-kernel-extension/src/index.ts index d000ec82..f0b14473 100644 --- a/packages/pyodide-kernel-extension/src/index.ts +++ b/packages/pyodide-kernel-extension/src/index.ts @@ -20,7 +20,7 @@ const KERNEL_ICON_URL = `data:image/svg+xml;base64,${btoa(KERNEL_ICON_SVG_STR)}` /** * The default CDN fallback for Pyodide */ -const PYODIDE_CDN_URL = 'https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide.js'; +const PYODIDE_CDN_URL = 'https://cdn.jsdelivr.net/pyodide/v0.27.0/full/pyodide.js'; /** * The id for the extension, and key in the litePlugins. diff --git a/packages/pyodide-kernel/package.json b/packages/pyodide-kernel/package.json index ff211012..0144328f 100644 --- a/packages/pyodide-kernel/package.json +++ b/packages/pyodide-kernel/package.json @@ -66,7 +66,7 @@ "@types/jest": "^29.5.4", "esbuild": "^0.19.2", "jest": "^29.7.0", - "pyodide": "0.26.4", + "pyodide": "0.227.0", "rimraf": "^5.0.1", "ts-jest": "^26.3.0", "typescript": "~5.2.2" From 4f29ddea5667ac9e5d2185114de99284e96a5bcf Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 31 Dec 2024 17:39:20 -0600 Subject: [PATCH 2/5] accept some FS as any --- packages/pyodide-kernel/package.json | 2 +- packages/pyodide-kernel/src/coincident.worker.ts | 4 ++-- packages/pyodide-kernel/src/comlink.worker.ts | 4 ++-- packages/pyodide-kernel/src/worker.ts | 4 ++-- yarn.lock | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/pyodide-kernel/package.json b/packages/pyodide-kernel/package.json index 0144328f..775b0555 100644 --- a/packages/pyodide-kernel/package.json +++ b/packages/pyodide-kernel/package.json @@ -66,7 +66,7 @@ "@types/jest": "^29.5.4", "esbuild": "^0.19.2", "jest": "^29.7.0", - "pyodide": "0.227.0", + "pyodide": "0.27.0", "rimraf": "^5.0.1", "ts-jest": "^26.3.0", "typescript": "~5.2.2" diff --git a/packages/pyodide-kernel/src/coincident.worker.ts b/packages/pyodide-kernel/src/coincident.worker.ts index 9c1ad66e..b29e9c43 100644 --- a/packages/pyodide-kernel/src/coincident.worker.ts +++ b/packages/pyodide-kernel/src/coincident.worker.ts @@ -56,14 +56,14 @@ export class PyodideCoincidentKernel extends PyodideRemoteKernel { const { baseUrl } = options; const driveFS = new PyodideDriveFS({ - FS, + FS: FS as any, PATH, ERRNO_CODES, baseUrl, driveName: this._driveName, mountpoint, }); - FS.mkdir(mountpoint); + FS.mkdirTree(mountpoint); FS.mount(driveFS, {}, mountpoint); FS.chdir(mountpoint); this._driveFS = driveFS; diff --git a/packages/pyodide-kernel/src/comlink.worker.ts b/packages/pyodide-kernel/src/comlink.worker.ts index d7efe65f..d20d4f62 100644 --- a/packages/pyodide-kernel/src/comlink.worker.ts +++ b/packages/pyodide-kernel/src/comlink.worker.ts @@ -49,14 +49,14 @@ export class PyodideComlinkKernel extends PyodideRemoteKernel { const { baseUrl } = options; const driveFS = new PyodideDriveFS({ - FS, + FS: FS as any, PATH, ERRNO_CODES, baseUrl, driveName: this._driveName, mountpoint, }); - FS.mkdir(mountpoint); + FS.mkdirTree(mountpoint); FS.mount(driveFS, {}, mountpoint); FS.chdir(mountpoint); this._driveFS = driveFS; diff --git a/packages/pyodide-kernel/src/worker.ts b/packages/pyodide-kernel/src/worker.ts index 8f50a4f5..6b6c2208 100644 --- a/packages/pyodide-kernel/src/worker.ts +++ b/packages/pyodide-kernel/src/worker.ts @@ -137,14 +137,14 @@ export class PyodideRemoteKernel { const { DriveFS } = await import('@jupyterlite/contents'); const driveFS = new DriveFS({ - FS, + FS: FS as any, PATH, ERRNO_CODES, baseUrl, driveName: this._driveName, mountpoint, }); - FS.mkdir(mountpoint); + FS.mkdirTree(mountpoint); FS.mount(driveFS, {}, mountpoint); FS.chdir(mountpoint); this._driveFS = driveFS; diff --git a/yarn.lock b/yarn.lock index 3adaafa7..175a10fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3009,7 +3009,7 @@ __metadata: comlink: ^4.4.2 esbuild: ^0.19.2 jest: ^29.7.0 - pyodide: 0.26.4 + pyodide: 0.27.0 rimraf: ^5.0.1 ts-jest: ^26.3.0 typescript: ~5.2.2 @@ -10919,12 +10919,12 @@ __metadata: languageName: node linkType: hard -"pyodide@npm:0.26.4": - version: 0.26.4 - resolution: "pyodide@npm:0.26.4" +"pyodide@npm:0.27.0": + version: 0.27.0 + resolution: "pyodide@npm:0.27.0" dependencies: ws: ^8.5.0 - checksum: 6e2d6205022232309076a7ce7cf10b68e5d7dbcac9679a9378c579fabb5c0ba3349b325f16c05b74a9fbbf188b1f16f5c5fb97a4c33e3bced5da0fb3d01d57f8 + checksum: 8d5382b16f37659595488ce69c46beb855a7fc3950254324f98c1cf619a9cc9ac2e304331a343391b8135200732b0a1a13f629989c13ca02b70a2e9dd8cb9029 languageName: node linkType: hard From fb11901271a4cc627100838edb859f3e1d7ad0c6 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 31 Dec 2024 22:21:11 -0600 Subject: [PATCH 3/5] rework piplite --- jupyterlite_pyodide_kernel/constants.py | 20 +++++++++++++------ packages/pyodide-kernel/py/piplite/README.md | 2 +- .../pyodide-kernel/py/piplite/piplite/cli.py | 18 ++++++++++------- .../py/piplite/piplite/piplite.py | 10 +++++++--- .../py/pyodide-kernel/README.md | 2 +- yarn.lock | 6 +++--- 6 files changed, 37 insertions(+), 21 deletions(-) diff --git a/jupyterlite_pyodide_kernel/constants.py b/jupyterlite_pyodide_kernel/constants.py index d31ab02f..c6dbdf89 100644 --- a/jupyterlite_pyodide_kernel/constants.py +++ b/jupyterlite_pyodide_kernel/constants.py @@ -1,6 +1,6 @@ """Well-known (and otherwise) constants used by ``jupyterlite-pyodide-kernel``""" -### pyodide-specific values +### Pyodide-specific values #: the key for PyPI-compatible API responses pointing to wheels PIPLITE_URLS = "pipliteUrls" DISABLE_PYPI_FALLBACK = "disablePyPIFallback" @@ -10,9 +10,9 @@ KERNEL_SETTINGS_SCHEMA = "kernel.v0.schema.json" #: where we put wheels, for now PYPI_WHEELS = "pypi" -#: the plugin id for the pydodide kernel labextension +#: the plugin id for the Pydodide kernel labextension PYODIDE_KERNEL_PLUGIN_ID = "@jupyterlite/pyodide-kernel-extension:kernel" -#: the npm name of the pyodide kernel +#: the npm name of the Pyodide kernel PYODIDE_KERNEL_NPM_NAME = PYODIDE_KERNEL_PLUGIN_ID.split(":")[0] #: the package.json key for piplite PKG_JSON_PIPLITE = "piplite" @@ -34,7 +34,15 @@ #: the only kind of noarch wheel piplite understands NOARCH_WHL = "py3-none-any.whl" -#: the only kind of binary wheel piplite understands -WASM_WHL = "emscripten_*_wasm32.whl" +#: the only kind of binary wheel piplite previously understood +EMSCRIPTEN_ABI_WHL = "emscripten_*_wasm32.whl" -ALL_WHL = [NOARCH_WHL, WASM_WHL] +#: legacy variable alias +WASM_WHL = EMSCRIPTEN_ABI_WHL + +#: the Pyodide ABI wheel is the same as the Emscripten +#: ABI wheel, but with a different platform tag, i.e., +# YYYY_buildnumber. +PYODIDE_ABI_WHL = "pyodide_*_wasm32.whl" + +ALL_WHL = [NOARCH_WHL, WASM_WHL, PYODIDE_ABI_WHL] diff --git a/packages/pyodide-kernel/py/piplite/README.md b/packages/pyodide-kernel/py/piplite/README.md index 1adfe1ba..05f93512 100644 --- a/packages/pyodide-kernel/py/piplite/README.md +++ b/packages/pyodide-kernel/py/piplite/README.md @@ -2,7 +2,7 @@ This is a companion package to [micropip](https://github.com/pyodide/pyodide/tree/main/packages/micropip) which only -works inside a [pyodide](https://github.com/pyodide/pyodide/) runtime. +works inside a [Pyodide](https://github.com/pyodide/pyodide/) runtime. It adds the ability to use extra Warehouse-like API responses to resolve `pip` dependencies, and can disable the fallback to `pypi.org` diff --git a/packages/pyodide-kernel/py/piplite/piplite/cli.py b/packages/pyodide-kernel/py/piplite/piplite/cli.py index 8de46f34..f4da0311 100644 --- a/packages/pyodide-kernel/py/piplite/piplite/cli.py +++ b/packages/pyodide-kernel/py/piplite/piplite/cli.py @@ -7,15 +7,19 @@ .. code: async def install( - requirements: str | list[str], - keep_going: bool = False, # --verbose - deps: bool = True, # --no-deps - credentials: str | None = None, - pre: bool = False, # --pre - ) -> None: + self, + requirements: str | list[str], # -r and [packages] + keep_going: bool = False, # --verbose + deps: bool = True, # --no-deps + credentials: str | None = None, # no CLI alias + pre: bool = False, # --pre + index_urls: list[str] | str | None = None, # no CLI alias + *, + verbose: bool | int | None = None, + ): ``` -As this is _not_ really a CLI, it doesn't bother with accurate return codes, and should +As this is _not_ really a CLI, it doesn't bother with accurate return codes, and failures should not block execution. """ diff --git a/packages/pyodide-kernel/py/piplite/piplite/piplite.py b/packages/pyodide-kernel/py/piplite/piplite/piplite.py index 7916d6f5..07c87a8e 100644 --- a/packages/pyodide-kernel/py/piplite/piplite/piplite.py +++ b/packages/pyodide-kernel/py/piplite/piplite/piplite.py @@ -99,7 +99,11 @@ async def _query_package( f"{name} could not be installed: PyPI fallback is disabled" ) - return await _MP_QUERY_PACKAGE(name, fetch_kwargs, index_urls) + return await _MP_QUERY_PACKAGE( + name=name, + fetch_kwargs=fetch_kwargs, + index_urls=index_urls + ) async def _install( @@ -174,14 +178,14 @@ def install( keep_going : - This parameter decides the behavior of the micropip when it encounters a + This parameter decides the behavior of micropip when it encounters a Python package without a pure Python wheel while doing dependency resolution: - If ``False``, an error will be raised on first package with a missing wheel. - - If ``True``, the micropip will keep going after the first error, and + - If ``True``, micropip will keep going after the first error, and report a list of errors at the end. deps : diff --git a/packages/pyodide-kernel/py/pyodide-kernel/README.md b/packages/pyodide-kernel/py/pyodide-kernel/README.md index c9872011..22c370d2 100644 --- a/packages/pyodide-kernel/py/pyodide-kernel/README.md +++ b/packages/pyodide-kernel/py/pyodide-kernel/README.md @@ -1,4 +1,4 @@ # pyodide-kernel This is an companion package to [IPython](https://github.com/ipython/ipython) which only -works inside a [pyodide](https://github.com/pyodide/pyodide/) runtime. +works inside a [Pyodide](https://github.com/pyodide/pyodide/) runtime. diff --git a/yarn.lock b/yarn.lock index 175a10fb..b0705bff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2340,8 +2340,8 @@ __metadata: linkType: hard "@jupyterlab/builder@npm:~4.2.1": - version: 4.2.1 - resolution: "@jupyterlab/builder@npm:4.2.1" + version: 4.2.6 + resolution: "@jupyterlab/builder@npm:4.2.6" dependencies: "@lumino/algorithm": ^2.0.1 "@lumino/application": ^2.3.1 @@ -2376,7 +2376,7 @@ __metadata: worker-loader: ^3.0.2 bin: build-labextension: lib/build-labextension.js - checksum: d8ea62deab2866be6fd0147470bd2ebd4970d1f628428e3354f86e8b8121a83ce3074eeead65427f09042eec8d88b4d1f1c2830972fc529ba5a084ada6be63b0 + checksum: 114b922c8cd5d99f6589a0d6581b3489f4d6916a3fb8b04528d12dc607513405b6c42c1c8a767d647c9fd7fda8aeeeaeb6e0f370841f4077c9e0472dde3abb5c languageName: node linkType: hard From 909c86936b668a714bdf1b6047c2521279315244 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 31 Dec 2024 22:41:02 -0600 Subject: [PATCH 4/5] also invert _query_packages ordering --- packages/pyodide-kernel/py/piplite/piplite/piplite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/pyodide-kernel/py/piplite/piplite/piplite.py b/packages/pyodide-kernel/py/piplite/piplite/piplite.py index 07c87a8e..e19b7e24 100644 --- a/packages/pyodide-kernel/py/piplite/piplite/piplite.py +++ b/packages/pyodide-kernel/py/piplite/piplite/piplite.py @@ -79,8 +79,8 @@ async def _get_pypi_json_from_index(name, piplite_url, fetch_kwargs) -> ProjectI async def _query_package( name: str, - fetch_kwargs: dict[str, Any] | None = None, index_urls: list[str] | str | None = None, + fetch_kwargs: dict[str, Any] | None = None, ) -> ProjectInfo: """Fetch the warehouse API metadata for a specific ``pkgname``.""" for piplite_url in _PIPLITE_URLS: @@ -101,8 +101,8 @@ async def _query_package( return await _MP_QUERY_PACKAGE( name=name, + index_urls=index_urls, fetch_kwargs=fetch_kwargs, - index_urls=index_urls ) From e3c95768208b0305000a1af0d407b8f92ba71ed1 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 31 Dec 2024 23:10:41 -0600 Subject: [PATCH 5/5] update compatibility matrix --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d6d7676..93a552cc 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ yet work in a full, `jupyter_server`-hosted client such as JupyterLab or Noteboo | `>=0.1.2,<=0.2.1` | `0.24.*` | `3.10.*` | `3.1.45` | | `>=0.2.2,<=0.2.3` | `0.25.*` | `3.11.*` | `3.1.46` | | `>=0.3.*,<=0.4.0` | `0.25.*` | `3.11.*` | `3.1.46` | -| `>=0.4.*,<=0.5.0` | `0.26.*` | `3.12.*` | `3.1.58` | +| `>=0.4.*,<=0.4.6` | `0.26.*` | `3.12.*` | `3.1.58` | +| `>=0.4.7,<=0.5.0` | `0.27.*` | `3.12.*` | `3.1.58` | Note that the Emscripten version is strict down to the bugfix version.