Skip to content

Commit bf33a11

Browse files
authored
Update jupyterlite + mambajs (#211)
* Update jupyterlite + mambajs * Update * Update
1 parent 50955a4 commit bf33a11

File tree

12 files changed

+1604
-1651
lines changed

12 files changed

+1604
-1651
lines changed

docs/build-environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ dependencies:
1818
- empack >=3.1.0
1919
- pip:
2020
- jupyterlab >=4.4.0.b0,<5
21-
- jupyterlite-core >=0.6.0.a3,<0.7
21+
- jupyterlite-core >=0.6.0.a8,<0.7
2222
- ..

packages/xeus-extension/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@
4141
"watch:labextension": "jupyter labextension watch ."
4242
},
4343
"dependencies": {
44-
"@jupyterlab/application": "^4.4.0-beta.0",
45-
"@jupyterlab/coreutils": "^6.4.0-beta.0",
46-
"@jupyterlab/logconsole": "^4.4.0-beta.0",
47-
"@jupyterlab/notebook": "^4.4.0-beta.0",
48-
"@jupyterlite/contents": "^0.6.0-alpha.4",
49-
"@jupyterlite/kernel": "^0.6.0-alpha.4",
50-
"@jupyterlite/server": "^0.6.0-alpha.4",
44+
"@jupyterlab/application": "^4.4.0-rc.1",
45+
"@jupyterlab/coreutils": "^6.4.0-rc.1",
46+
"@jupyterlab/logconsole": "^4.4.0-rc.1",
47+
"@jupyterlab/notebook": "^4.4.0-rc.1",
48+
"@jupyterlite/contents": "^0.6.0-alpha.8",
49+
"@jupyterlite/kernel": "^0.6.0-alpha.8",
50+
"@jupyterlite/server": "^0.6.0-alpha.8",
5151
"@jupyterlite/xeus": "^4.0.0-a2",
5252
"@lumino/coreutils": "^2"
5353
},
5454
"devDependencies": {
55-
"@jupyterlab/builder": "^4.4.0-beta.0",
55+
"@jupyterlab/builder": "^4.4.0-rc.0",
5656
"@types/json-schema": "^7.0.11",
5757
"@types/react": "^18.0.26",
5858
"@types/react-addons-linked-state-mixin": "^0.14.22",

packages/xeus-extension/src/index.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { NotebookPanel } from '@jupyterlab/notebook';
1818
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
1919

2020
import { IServiceWorkerManager } from '@jupyterlite/server';
21-
import { IBroadcastChannelWrapper } from '@jupyterlite/contents';
2221
import { IKernel, IKernelSpecs } from '@jupyterlite/kernel';
2322

2423
import { WebWorkerKernel } from '@jupyterlite/xeus';
@@ -60,16 +59,11 @@ const kernelPlugin: JupyterFrontEndPlugin<void> = {
6059
id: '@jupyterlite/xeus-kernel:register',
6160
autoStart: true,
6261
requires: [IKernelSpecs],
63-
optional: [
64-
IServiceWorkerManager,
65-
IBroadcastChannelWrapper,
66-
IEmpackEnvMetaFile
67-
],
62+
optional: [IServiceWorkerManager, IEmpackEnvMetaFile],
6863
activate: async (
6964
app: JupyterFrontEnd,
7065
kernelspecs: IKernelSpecs,
7166
serviceWorker?: IServiceWorkerManager,
72-
broadcastChannel?: IBroadcastChannelWrapper,
7367
empackEnvMetaFile?: IEmpackEnvMetaFile
7468
) => {
7569
// Fetch kernel list
@@ -98,10 +92,7 @@ const kernelPlugin: JupyterFrontEndPlugin<void> = {
9892
kernelspecs.register({
9993
spec: kernelspec,
10094
create: async (options: IKernel.IOptions): Promise<IKernel> => {
101-
const mountDrive = !!(
102-
(serviceWorker?.enabled && broadcastChannel?.enabled) ||
103-
crossOriginIsolated
104-
);
95+
const mountDrive = !!(serviceWorker?.enabled || crossOriginIsolated);
10596

10697
if (mountDrive) {
10798
console.info(
@@ -121,7 +112,8 @@ const kernelPlugin: JupyterFrontEndPlugin<void> = {
121112
contentsManager,
122113
mountDrive,
123114
kernelSpec: kernelspec,
124-
empackEnvMetaLink: link
115+
empackEnvMetaLink: link,
116+
browsingContextId: serviceWorker?.browsingContextId || ''
125117
});
126118
}
127119
});

packages/xeus/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@
3636
"watch:src": "tsc -w --sourceMap"
3737
},
3838
"dependencies": {
39-
"@emscripten-forge/mambajs": "^0.7.0",
40-
"@jupyterlab/coreutils": "^6.4.0-beta.0",
41-
"@jupyterlab/services": "^7.4.0-beta.0",
42-
"@jupyterlite/contents": "^0.6.0-alpha.4",
43-
"@jupyterlite/kernel": "^0.6.0-alpha.4",
44-
"@jupyterlite/server": "^0.6.0-alpha.4",
39+
"@emscripten-forge/mambajs": "^0.8.1",
40+
"@jupyterlab/coreutils": "^6.4.0-rc.1",
41+
"@jupyterlab/services": "^7.4.0-rc.1",
42+
"@jupyterlite/contents": "^0.6.0-alpha.8",
43+
"@jupyterlite/kernel": "^0.6.0-alpha.8",
44+
"@jupyterlite/server": "^0.6.0-alpha.8",
4545
"@lumino/coreutils": "^2",
4646
"@lumino/signaling": "^2",
4747
"coincident": "^1.2.3",
4848
"comlink": "^4.4.1"
4949
},
5050
"devDependencies": {
51-
"@jupyterlab/builder": "^4.4.0-beta.0",
51+
"@jupyterlab/builder": "^4.4.0-rc.0",
5252
"@types/json-schema": "^7.0.11",
5353
"@types/react": "^18.0.26",
5454
"@types/react-addons-linked-state-mixin": "^0.14.22",

packages/xeus/src/coincident.worker.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ export class SharedBufferContentsAPI extends ContentsAPI {
3131
*/
3232
class XeusDriveFS extends DriveFS {
3333
createAPI(options: DriveFS.IOptions): ContentsAPI {
34-
return new SharedBufferContentsAPI(
35-
options.driveName,
36-
options.mountpoint,
37-
options.FS,
38-
options.ERRNO_CODES
39-
);
34+
return new SharedBufferContentsAPI(options);
4035
}
4136
}
4237

@@ -47,7 +42,8 @@ export class XeusCoincidentKernel extends XeusRemoteKernel {
4742
async mount(
4843
driveName: string,
4944
mountpoint: string,
50-
baseUrl: string
45+
baseUrl: string,
46+
browsingContextId: string
5147
): Promise<void> {
5248
const { FS, PATH, ERRNO_CODES } = globalThis.Module;
5349

@@ -61,7 +57,8 @@ export class XeusCoincidentKernel extends XeusRemoteKernel {
6157
ERRNO_CODES,
6258
baseUrl,
6359
driveName,
64-
mountpoint
60+
mountpoint,
61+
browsingContextId
6562
});
6663

6764
FS.mkdir(mountpoint);

packages/xeus/src/comlink.worker.ts

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,34 @@
77

88
import { expose } from 'comlink';
99

10-
import {
11-
ContentsAPI,
12-
DriveFS,
13-
ServiceWorkerContentsAPI
14-
} from '@jupyterlite/contents';
10+
import { DriveFS } from '@jupyterlite/contents';
1511

1612
import { XeusRemoteKernel } from './worker';
1713

18-
/**
19-
* A custom drive implementation which uses the service worker
20-
*/
21-
class XeusDriveFS extends DriveFS {
22-
createAPI(options: DriveFS.IOptions): ContentsAPI {
23-
return new ServiceWorkerContentsAPI(
24-
options.baseUrl,
25-
options.driveName,
26-
options.mountpoint,
27-
options.FS,
28-
options.ERRNO_CODES
29-
);
30-
}
31-
}
32-
3314
export class XeusComlinkKernel extends XeusRemoteKernel {
3415
/**
3516
* Setup custom Emscripten FileSystem
3617
*/
3718
async mount(
3819
driveName: string,
3920
mountpoint: string,
40-
baseUrl: string
21+
baseUrl: string,
22+
browsingContextId: string
4123
): Promise<void> {
4224
const { FS, PATH, ERRNO_CODES } = globalThis.Module;
4325

4426
if (!FS) {
4527
return;
4628
}
4729

48-
const drive = new XeusDriveFS({
30+
const drive = new DriveFS({
4931
FS,
5032
PATH,
5133
ERRNO_CODES,
5234
baseUrl,
5335
driveName,
54-
mountpoint
36+
mountpoint,
37+
browsingContextId
5538
});
5639

5740
FS.mkdir(mountpoint);

packages/xeus/src/interfaces.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ export interface IXeusWorkerKernel extends IWorkerKernel {
5353
* @param driveName The name of the drive
5454
* @param mountpoint The mountpoint of the drive
5555
* @param baseUrl The base URL of the server
56+
* @param browsingContextId The current page id
5657
*/
57-
mount(driveName: string, mountpoint: string, baseUrl: string): Promise<void>;
58+
mount(
59+
driveName: string,
60+
mountpoint: string,
61+
baseUrl: string,
62+
browsingContextId: string
63+
): Promise<void>;
5864

5965
/**
6066
* Change the current working directory

packages/xeus/src/web_worker_kernel.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ export class WebWorkerKernel implements IKernel {
273273
await this._remoteKernel.mount(
274274
driveName,
275275
'/drive',
276-
PageConfig.getBaseUrl()
276+
PageConfig.getBaseUrl(),
277+
options.browsingContextId
277278
);
278279

279280
if (await this._remoteKernel.isDir('/files')) {
@@ -315,5 +316,6 @@ export namespace WebWorkerKernel {
315316
mountDrive: boolean;
316317
kernelSpec: any;
317318
empackEnvMetaLink?: string | undefined;
319+
browsingContextId: string;
318320
}
319321
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
dependencies = [
2626
"empack>=5,<6",
2727
"traitlets",
28-
"jupyterlite-core>=0.6.0a4,<0.7",
28+
"jupyterlite-core>=0.6.0a8,<0.7",
2929
"pyyaml",
3030
"requests",
3131
]

ui-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"test:update": "playwright test --update-snapshots"
1616
},
1717
"devDependencies": {
18-
"@playwright/test": "^1.45.0",
1918
"rimraf": "^5.0.5"
2019
},
2120
"dependencies": {
22-
"@jupyterlab/galata": "~5.2.4"
21+
"@jupyterlab/galata": "~5.4.0",
22+
"@playwright/test": "^1.48.0"
2323
}
2424
}

0 commit comments

Comments
 (0)