@jupyterlite/pyodide-kernel 0.8.0-beta.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -2,5 +2,6 @@ export * from './_pypi';
2
2
  export * from './coincident.worker';
3
3
  export * from './comlink.worker';
4
4
  export * from './kernel';
5
+ export * from './loader';
5
6
  export * from './tokens';
6
7
  export * from './worker';
package/lib/index.js CHANGED
@@ -4,5 +4,6 @@ export * from './_pypi';
4
4
  export * from './coincident.worker';
5
5
  export * from './comlink.worker';
6
6
  export * from './kernel';
7
+ export * from './loader';
7
8
  export * from './tokens';
8
9
  export * from './worker';
package/lib/kernel.d.ts CHANGED
@@ -18,8 +18,13 @@ export declare class PyodideKernel extends BaseKernel implements IKernel {
18
18
  *
19
19
  * ### Note
20
20
  *
21
- * Subclasses must implement this typographically almost _exactly_ for
22
- * webpack to find it.
21
+ * The worker files are self-contained ES modules prebuilt with esbuild,
22
+ * see the `build:workers` scripts. The `createModuleWorker` indirection
23
+ * keeps bundlers from re-bundling them as worker entry points and
24
+ * downgrading them to classic workers. They are instead emitted as plain
25
+ * assets, see the `*.worker.js` rule in
26
+ * `pyodide-kernel-extension/webpack.config.js` and
27
+ * https://github.com/jupyterlite/pyodide-kernel/pull/294 for details.
23
28
  */
24
29
  protected initWorker(options: PyodideKernel.IOptions): Worker;
25
30
  /**
package/lib/kernel.js CHANGED
@@ -1,3 +1,5 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
1
3
  import coincident from 'coincident';
2
4
  import { wrap } from 'comlink';
3
5
  import { PromiseDelegate } from '@lumino/coreutils';
@@ -28,19 +30,21 @@ export class PyodideKernel extends BaseKernel {
28
30
  *
29
31
  * ### Note
30
32
  *
31
- * Subclasses must implement this typographically almost _exactly_ for
32
- * webpack to find it.
33
+ * The worker files are self-contained ES modules prebuilt with esbuild,
34
+ * see the `build:workers` scripts. The `createModuleWorker` indirection
35
+ * keeps bundlers from re-bundling them as worker entry points and
36
+ * downgrading them to classic workers. They are instead emitted as plain
37
+ * assets, see the `*.worker.js` rule in
38
+ * `pyodide-kernel-extension/webpack.config.js` and
39
+ * https://github.com/jupyterlite/pyodide-kernel/pull/294 for details.
33
40
  */
34
41
  initWorker(options) {
42
+ const createModuleWorker = (url) => new Worker(url, { type: 'module' });
35
43
  if (crossOriginIsolated) {
36
- return new Worker(new URL('./coincident.worker.js', import.meta.url), {
37
- type: 'module',
38
- });
44
+ return createModuleWorker(new URL('./coincident.worker.js', import.meta.url));
39
45
  }
40
46
  else {
41
- return new Worker(new URL('./comlink.worker.js', import.meta.url), {
42
- type: 'module',
43
- });
47
+ return createModuleWorker(new URL('./comlink.worker.js', import.meta.url));
44
48
  }
45
49
  }
46
50
  /**
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Import an ES module from a URL only known at runtime.
3
+ *
4
+ * The `import()` call is wrapped in `new Function` to keep it out of bundler
5
+ * static analysis, which would otherwise rewrite it into a module lookup that
6
+ * cannot resolve a runtime URL. See
7
+ * https://github.com/jupyterlite/pyodide-kernel/pull/294 for details.
8
+ *
9
+ * This is used to load Pyodide. Pyodide 314.0.0 and later is ESM-only and
10
+ * must be loaded from its `pyodide.mjs` entry point, see
11
+ * https://blog.pyodide.org/posts/314-release/.
12
+ */
13
+ export declare function importModule<T = unknown>(url: string): Promise<T>;
package/lib/loader.js ADDED
@@ -0,0 +1,18 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ /**
4
+ * Import an ES module from a URL only known at runtime.
5
+ *
6
+ * The `import()` call is wrapped in `new Function` to keep it out of bundler
7
+ * static analysis, which would otherwise rewrite it into a module lookup that
8
+ * cannot resolve a runtime URL. See
9
+ * https://github.com/jupyterlite/pyodide-kernel/pull/294 for details.
10
+ *
11
+ * This is used to load Pyodide. Pyodide 314.0.0 and later is ESM-only and
12
+ * must be loaded from its `pyodide.mjs` entry point, see
13
+ * https://blog.pyodide.org/posts/314-release/.
14
+ */
15
+ export async function importModule(url) {
16
+ const dynamicImport = new Function('url', 'return import(url)');
17
+ return dynamicImport(url);
18
+ }
package/lib/tokens.d.ts CHANGED
@@ -71,7 +71,7 @@ export declare namespace IPyodideWorkerKernel {
71
71
  */
72
72
  interface IOptions extends IWorkerKernel.IOptions {
73
73
  /**
74
- * The URL of the main `pyodide.js` file in the standard pyodide layout.
74
+ * The URL of the main `pyodide.mjs` file in the standard pyodide layout.
75
75
  */
76
76
  pyodideUrl: string;
77
77
  /**
package/lib/worker.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
+ import { importModule } from './loader';
3
4
  export class PyodideRemoteKernel {
4
5
  constructor() {
5
6
  /**
@@ -42,17 +43,7 @@ export class PyodideRemoteKernel {
42
43
  }
43
44
  async initRuntime(options) {
44
45
  const { pyodideUrl, indexUrl } = options;
45
- let loadPyodide;
46
- if (pyodideUrl.endsWith('.mjs')) {
47
- // note: this does not work at all in firefox
48
- const pyodideModule = await import(
49
- /* webpackIgnore: true */ pyodideUrl);
50
- loadPyodide = pyodideModule.loadPyodide;
51
- }
52
- else {
53
- importScripts(pyodideUrl);
54
- loadPyodide = self.loadPyodide;
55
- }
46
+ const { loadPyodide } = await importModule(pyodideUrl);
56
47
  this._pyodide = await loadPyodide({
57
48
  indexURL: indexUrl,
58
49
  stdout: (text) => {
@@ -109,14 +100,7 @@ ${e.stack}`;
109
100
  }
110
101
  async initKernel(options) {
111
102
  const preloaded = (options.loadPyodideOptions || {}).packages || [];
112
- const toLoad = [
113
- 'sqlite3',
114
- 'ipykernel',
115
- 'comm',
116
- 'pyodide_kernel',
117
- 'jedi',
118
- 'ipython',
119
- ];
103
+ const toLoad = ['ipykernel', 'comm', 'pyodide-kernel', 'jedi', 'ipython'];
120
104
  const scriptLines = [];
121
105
  // use piplite for packages that weren't pre-loaded
122
106
  for (const pkgName of toLoad) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlite/pyodide-kernel",
3
- "version": "0.8.0-beta.0",
3
+ "version": "0.8.0",
4
4
  "description": "JupyterLite - Pyodide Kernel",
5
5
  "homepage": "https://github.com/jupyterlite/pyodide-kernel",
6
6
  "bugs": {
@@ -50,16 +50,16 @@
50
50
  "watch": "tsc -b --watch"
51
51
  },
52
52
  "dependencies": {
53
- "@jupyterlab/coreutils": "^6.6.0-beta.0",
54
- "@jupyterlab/logconsole": "^4.6.0-beta.0",
55
- "@jupyterlite/services": "^0.8.0-beta.0",
53
+ "@jupyterlab/coreutils": "^6.6.0",
54
+ "@jupyterlab/logconsole": "^4.6.0",
55
+ "@jupyterlite/services": "^0.8.0",
56
56
  "coincident": "^1.2.3",
57
57
  "comlink": "^4.4.2"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@babel/core": "^7.22.17",
61
61
  "esbuild": "^0.19.2",
62
- "pyodide": "0.29.4",
62
+ "pyodide": "314.0.0",
63
63
  "rimraf": "^6.0.1",
64
64
  "typescript": "~5.2.2"
65
65
  },
@@ -68,8 +68,8 @@
68
68
  },
69
69
  "pyodide-kernel": {
70
70
  "packages": {
71
- "py/pyodide-kernel": "0.8.0b0",
72
- "py/piplite": "0.8.0b0",
71
+ "py/pyodide-kernel": "0.8.0",
72
+ "py/piplite": "0.8.0",
73
73
  "py/ipykernel": "6.9.2",
74
74
  "py/widgetsnbextension3/widgetsnbextension": "3.6.999",
75
75
  "py/widgetsnbextension4/widgetsnbextension": "4.0.999"
package/pypi/all.json CHANGED
@@ -5,19 +5,19 @@
5
5
  {
6
6
  "comment_text": "",
7
7
  "digests": {
8
- "md5": "5bdbe99264269d31b1b7a8dc5282742f",
9
- "sha256": "d792ee20c5d0ffc3ea057b0e454d12ae37ea82a9c993447d7cdc901bd373e5b5"
8
+ "md5": "33a4f593edcab5786889af6b237f5cf2",
9
+ "sha256": "de8d2f82c247388fde84dab9d0d25a6aa2fb62c2e0de3caf20d0e7b9849f9a40"
10
10
  },
11
11
  "downloads": -1,
12
12
  "filename": "ipykernel-6.9.2-py3-none-any.whl",
13
13
  "has_sig": false,
14
- "md5_digest": "5bdbe99264269d31b1b7a8dc5282742f",
14
+ "md5_digest": "33a4f593edcab5786889af6b237f5cf2",
15
15
  "packagetype": "bdist_wheel",
16
16
  "python_version": "py3",
17
17
  "requires_python": ">=3.13",
18
18
  "size": 2712,
19
- "upload_time": "2026-05-25T16:57:58.871882Z",
20
- "upload_time_iso_8601": "2026-05-25T16:57:58.871882Z",
19
+ "upload_time": "2026-06-24T12:40:49.919885Z",
20
+ "upload_time_iso_8601": "2026-06-24T12:40:49.919885Z",
21
21
  "url": "./ipykernel-6.9.2-py3-none-any.whl",
22
22
  "yanked": false,
23
23
  "yanked_reason": null
@@ -27,24 +27,24 @@
27
27
  },
28
28
  "piplite": {
29
29
  "releases": {
30
- "0.8.0b0": [
30
+ "0.8.0": [
31
31
  {
32
32
  "comment_text": "",
33
33
  "digests": {
34
- "md5": "71853d27e908ecb7419db5aef2bb3eba",
35
- "sha256": "462f9a28dcc5e7d03e2a8799ae14ac590e97a8a15f40241bb3385647e02d1e49"
34
+ "md5": "353b97f44677bdfb08698c46f1394983",
35
+ "sha256": "6dd9726a06f9963272a1650846e21880a0b8df144b3c118c9561e64e3f463b7a"
36
36
  },
37
37
  "downloads": -1,
38
- "filename": "piplite-0.8.0b0-py3-none-any.whl",
38
+ "filename": "piplite-0.8.0-py3-none-any.whl",
39
39
  "has_sig": false,
40
- "md5_digest": "71853d27e908ecb7419db5aef2bb3eba",
40
+ "md5_digest": "353b97f44677bdfb08698c46f1394983",
41
41
  "packagetype": "bdist_wheel",
42
42
  "python_version": "py3",
43
43
  "requires_python": ">=3.13",
44
- "size": 7950,
45
- "upload_time": "2026-05-25T16:57:58.871675Z",
46
- "upload_time_iso_8601": "2026-05-25T16:57:58.871675Z",
47
- "url": "./piplite-0.8.0b0-py3-none-any.whl",
44
+ "size": 7917,
45
+ "upload_time": "2026-06-24T12:40:49.919640Z",
46
+ "upload_time_iso_8601": "2026-06-24T12:40:49.919640Z",
47
+ "url": "./piplite-0.8.0-py3-none-any.whl",
48
48
  "yanked": false,
49
49
  "yanked_reason": null
50
50
  }
@@ -53,24 +53,24 @@
53
53
  },
54
54
  "pyodide-kernel": {
55
55
  "releases": {
56
- "0.8.0b0": [
56
+ "0.8.0": [
57
57
  {
58
58
  "comment_text": "",
59
59
  "digests": {
60
- "md5": "b35dff028122c65642a88b6c37dae4cf",
61
- "sha256": "ea22d21274a5e4ebdfc5d5b70eae1a2db2d460e7889f80adf796557633ac05d3"
60
+ "md5": "2ecfe74348e85815b26c4d6db3a9c1bc",
61
+ "sha256": "f50c435fa2805967f8f4bdad6909ae23b37b53a631a72a5221029f5856fbbb59"
62
62
  },
63
63
  "downloads": -1,
64
- "filename": "pyodide_kernel-0.8.0b0-py3-none-any.whl",
64
+ "filename": "pyodide_kernel-0.8.0-py3-none-any.whl",
65
65
  "has_sig": false,
66
- "md5_digest": "b35dff028122c65642a88b6c37dae4cf",
66
+ "md5_digest": "2ecfe74348e85815b26c4d6db3a9c1bc",
67
67
  "packagetype": "bdist_wheel",
68
68
  "python_version": "py3",
69
69
  "requires_python": ">=3.13",
70
- "size": 11410,
71
- "upload_time": "2026-05-25T16:57:58.871413Z",
72
- "upload_time_iso_8601": "2026-05-25T16:57:58.871413Z",
73
- "url": "./pyodide_kernel-0.8.0b0-py3-none-any.whl",
70
+ "size": 11388,
71
+ "upload_time": "2026-06-24T12:40:49.919378Z",
72
+ "upload_time_iso_8601": "2026-06-24T12:40:49.919378Z",
73
+ "url": "./pyodide_kernel-0.8.0-py3-none-any.whl",
74
74
  "yanked": false,
75
75
  "yanked_reason": null
76
76
  }
@@ -83,19 +83,19 @@
83
83
  {
84
84
  "comment_text": "",
85
85
  "digests": {
86
- "md5": "1bcec85f4ba9ce838dd7ccf8f9b5cf20",
87
- "sha256": "ff7b603d7cb5849af30925e58475d7834dd35cd6021a6435be97a8a87ccfd1ea"
86
+ "md5": "f624f9edb2af624106f1caa122538f99",
87
+ "sha256": "1bc5be94290fe2aebb37c290fc543d3a2394dd4fd2e151cf2acfec7048bef379"
88
88
  },
89
89
  "downloads": -1,
90
90
  "filename": "widgetsnbextension-3.6.999-py3-none-any.whl",
91
91
  "has_sig": false,
92
- "md5_digest": "1bcec85f4ba9ce838dd7ccf8f9b5cf20",
92
+ "md5_digest": "f624f9edb2af624106f1caa122538f99",
93
93
  "packagetype": "bdist_wheel",
94
94
  "python_version": "py3",
95
95
  "requires_python": ">=3.13",
96
- "size": 2346,
97
- "upload_time": "2026-05-25T16:57:58.872089Z",
98
- "upload_time_iso_8601": "2026-05-25T16:57:58.872089Z",
96
+ "size": 2347,
97
+ "upload_time": "2026-06-24T12:40:49.920115Z",
98
+ "upload_time_iso_8601": "2026-06-24T12:40:49.920115Z",
99
99
  "url": "./widgetsnbextension-3.6.999-py3-none-any.whl",
100
100
  "yanked": false,
101
101
  "yanked_reason": null
@@ -105,19 +105,19 @@
105
105
  {
106
106
  "comment_text": "",
107
107
  "digests": {
108
- "md5": "6a3787c1e12e0eee9af0de67af0485aa",
109
- "sha256": "edace5f88251c1eca0826e3f36e287a1e570b14a138ab30ed928f84269ba8839"
108
+ "md5": "4ebb9739f1a941497d57ef00c8350342",
109
+ "sha256": "bb217ae5d24a380df007bca247beeffe8e94612d80ae01b7045e8e928b5a2933"
110
110
  },
111
111
  "downloads": -1,
112
112
  "filename": "widgetsnbextension-4.0.999-py3-none-any.whl",
113
113
  "has_sig": false,
114
- "md5_digest": "6a3787c1e12e0eee9af0de67af0485aa",
114
+ "md5_digest": "4ebb9739f1a941497d57ef00c8350342",
115
115
  "packagetype": "bdist_wheel",
116
116
  "python_version": "py3",
117
117
  "requires_python": ">=3.13",
118
118
  "size": 2351,
119
- "upload_time": "2026-05-25T16:57:58.872319Z",
120
- "upload_time_iso_8601": "2026-05-25T16:57:58.872319Z",
119
+ "upload_time": "2026-06-24T12:40:49.920365Z",
120
+ "upload_time_iso_8601": "2026-06-24T12:40:49.920365Z",
121
121
  "url": "./widgetsnbextension-4.0.999-py3-none-any.whl",
122
122
  "yanked": false,
123
123
  "yanked_reason": null
index 0dd11c7..896f47e 100644
Binary file