@jupyterlite/xeus 2.1.2 → 3.0.0-a0
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/coincident.worker.js +1 -1
- package/lib/coincident.worker.js.map +1 -1
- package/lib/comlink.worker.js +1 -1
- package/lib/comlink.worker.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.js +5 -86
- package/lib/{tokens.d.ts → interfaces.d.ts} +0 -8
- package/lib/interfaces.js +3 -0
- package/lib/web_worker_kernel.d.ts +1 -1
- package/lib/worker.d.ts +1 -4
- package/lib/worker.js +0 -2
- package/package.json +8 -158
- package/LICENSE +0 -29
- package/README.md +0 -184
- package/lib/tokens.js +0 -4
- package/style/base.css +0 -5
- package/style/index.css +0 -1
- package/style/index.js +0 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export * from './coincident.worker';
|
|
2
|
+
export * from './comlink.worker';
|
|
3
|
+
export * from './interfaces';
|
|
4
|
+
export * from './web_worker_kernel';
|
|
5
|
+
export * from './worker';
|
package/lib/index.js
CHANGED
|
@@ -1,86 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { IBroadcastChannelWrapper } from '@jupyterlite/contents';
|
|
7
|
-
import { IKernelSpecs } from '@jupyterlite/kernel';
|
|
8
|
-
import { WebWorkerKernel } from './web_worker_kernel';
|
|
9
|
-
import { IEmpackEnvMetaFile } from './tokens';
|
|
10
|
-
function getJson(url) {
|
|
11
|
-
const json_url = URLExt.join(PageConfig.getBaseUrl(), url);
|
|
12
|
-
const xhr = new XMLHttpRequest();
|
|
13
|
-
xhr.open('GET', json_url, false);
|
|
14
|
-
xhr.send(null);
|
|
15
|
-
return JSON.parse(xhr.responseText);
|
|
16
|
-
}
|
|
17
|
-
let kernel_list = [];
|
|
18
|
-
try {
|
|
19
|
-
kernel_list = getJson('xeus/kernels.json');
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
console.log(`Could not fetch xeus/kernels.json: ${err}`);
|
|
23
|
-
throw err;
|
|
24
|
-
}
|
|
25
|
-
const plugins = kernel_list.map((kernel) => {
|
|
26
|
-
return {
|
|
27
|
-
id: `@jupyterlite/xeus-${kernel}:register`,
|
|
28
|
-
autoStart: true,
|
|
29
|
-
requires: [IKernelSpecs],
|
|
30
|
-
optional: [
|
|
31
|
-
IServiceWorkerManager,
|
|
32
|
-
IBroadcastChannelWrapper,
|
|
33
|
-
IEmpackEnvMetaFile
|
|
34
|
-
],
|
|
35
|
-
activate: (app, kernelspecs, serviceWorker, broadcastChannel, empackEnvMetaFile) => {
|
|
36
|
-
// Fetch kernel spec
|
|
37
|
-
const kernelspec = getJson('xeus/kernels/' + kernel + '/kernel.json');
|
|
38
|
-
kernelspec.name = kernel;
|
|
39
|
-
kernelspec.dir = kernel;
|
|
40
|
-
for (const [key, value] of Object.entries(kernelspec.resources)) {
|
|
41
|
-
kernelspec.resources[key] = URLExt.join(PageConfig.getBaseUrl(), value);
|
|
42
|
-
}
|
|
43
|
-
const contentsManager = app.serviceManager.contents;
|
|
44
|
-
kernelspecs.register({
|
|
45
|
-
spec: kernelspec,
|
|
46
|
-
create: async (options) => {
|
|
47
|
-
const mountDrive = !!(((serviceWorker === null || serviceWorker === void 0 ? void 0 : serviceWorker.enabled) && (broadcastChannel === null || broadcastChannel === void 0 ? void 0 : broadcastChannel.enabled)) ||
|
|
48
|
-
crossOriginIsolated);
|
|
49
|
-
if (mountDrive) {
|
|
50
|
-
console.info(`${kernelspec.name} contents will be synced with Jupyter Contents`);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
console.warn(`${kernelspec.name} contents will NOT be synced with Jupyter Contents`);
|
|
54
|
-
}
|
|
55
|
-
const link = empackEnvMetaFile
|
|
56
|
-
? await empackEnvMetaFile.getLink(kernelspec)
|
|
57
|
-
: '';
|
|
58
|
-
return new WebWorkerKernel({
|
|
59
|
-
...options,
|
|
60
|
-
contentsManager,
|
|
61
|
-
mountDrive,
|
|
62
|
-
kernelSpec: kernelspec,
|
|
63
|
-
empackEnvMetaLink: link
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
const empackEnvMetaPlugin = {
|
|
71
|
-
id: '@jupyterlite/xeus:empack-env-meta',
|
|
72
|
-
autoStart: true,
|
|
73
|
-
provides: IEmpackEnvMetaFile,
|
|
74
|
-
activate: () => {
|
|
75
|
-
return {
|
|
76
|
-
getLink: async (kernelspec) => {
|
|
77
|
-
const kernelName = kernelspec.name;
|
|
78
|
-
const kernel_root_url = URLExt.join(PageConfig.getBaseUrl(), `xeus/kernels/${kernelName}`);
|
|
79
|
-
return `${kernel_root_url}`;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
plugins.push(empackEnvMetaPlugin);
|
|
85
|
-
export default plugins;
|
|
86
|
-
export { IEmpackEnvMetaFile };
|
|
1
|
+
export * from './coincident.worker';
|
|
2
|
+
export * from './comlink.worker';
|
|
3
|
+
export * from './interfaces';
|
|
4
|
+
export * from './web_worker_kernel';
|
|
5
|
+
export * from './worker';
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { TDriveMethod, TDriveRequest, TDriveResponse } from '@jupyterlite/contents';
|
|
5
5
|
import { IWorkerKernel } from '@jupyterlite/kernel';
|
|
6
|
-
import { Token } from '@lumino/coreutils';
|
|
7
6
|
/**
|
|
8
7
|
* An interface for Xeus workers.
|
|
9
8
|
*/
|
|
@@ -68,10 +67,3 @@ export declare namespace IXeusWorkerKernel {
|
|
|
68
67
|
empackEnvMetaLink?: string;
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
|
-
export interface IEmpackEnvMetaFile {
|
|
72
|
-
/**
|
|
73
|
-
* Get empack_env_meta link.
|
|
74
|
-
*/
|
|
75
|
-
getLink: (kernelspec: Record<string, any>) => Promise<string>;
|
|
76
|
-
}
|
|
77
|
-
export declare const IEmpackEnvMetaFile: Token<IEmpackEnvMetaFile>;
|
|
@@ -2,7 +2,7 @@ import type { Remote } from 'comlink';
|
|
|
2
2
|
import { ISignal } from '@lumino/signaling';
|
|
3
3
|
import { Contents, KernelMessage } from '@jupyterlab/services';
|
|
4
4
|
import { IKernel } from '@jupyterlite/kernel';
|
|
5
|
-
import { IXeusWorkerKernel } from './
|
|
5
|
+
import { IXeusWorkerKernel } from './interfaces';
|
|
6
6
|
export declare class WebWorkerKernel implements IKernel {
|
|
7
7
|
/**
|
|
8
8
|
* Instantiate a new WebWorkerKernel
|
package/lib/worker.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IXeusWorkerKernel } from './tokens';
|
|
1
|
+
import { IXeusWorkerKernel } from './interfaces';
|
|
3
2
|
export declare class XeusRemoteKernel {
|
|
4
3
|
constructor(options?: XeusRemoteKernel.IOptions);
|
|
5
4
|
ready(): Promise<void>;
|
|
@@ -12,8 +11,6 @@ export declare class XeusRemoteKernel {
|
|
|
12
11
|
* @param callback the callback to register
|
|
13
12
|
*/
|
|
14
13
|
registerCallback(callback: (msg: any) => void): void;
|
|
15
|
-
protected _driveName: string;
|
|
16
|
-
protected _driveFS: DriveFS | null;
|
|
17
14
|
protected _sendWorkerMessage: (msg: any) => void;
|
|
18
15
|
}
|
|
19
16
|
export declare namespace XeusRemoteKernel {
|
package/lib/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlite/xeus",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "JupyterLite
|
|
3
|
+
"version": "3.0.0-a0",
|
|
4
|
+
"description": "JupyterLite Xeus kernels",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
7
7
|
"jupyterlab",
|
|
@@ -14,43 +14,26 @@
|
|
|
14
14
|
"license": "BSD-3-Clause",
|
|
15
15
|
"author": "JupyterLite Contributors",
|
|
16
16
|
"files": [
|
|
17
|
-
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}"
|
|
18
|
-
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
|
|
17
|
+
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}"
|
|
19
18
|
],
|
|
20
19
|
"main": "lib/index.js",
|
|
21
20
|
"types": "lib/index.d.ts",
|
|
22
|
-
"style": "style/index.css",
|
|
23
21
|
"repository": {
|
|
24
22
|
"type": "git",
|
|
25
23
|
"url": "https://github.com/jupyterlite/xeus.git"
|
|
26
24
|
},
|
|
27
25
|
"scripts": {
|
|
28
|
-
"build": "jlpm build:lib && jlpm build:worker
|
|
29
|
-
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:worker:prod
|
|
26
|
+
"build": "jlpm build:lib && jlpm build:worker",
|
|
27
|
+
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:worker:prod",
|
|
30
28
|
"build:worker": "webpack --config worker.webpack.config.js --mode=development",
|
|
31
29
|
"build:worker:prod": "webpack --config worker.webpack.config.js --mode=production",
|
|
32
|
-
"build:labextension": "jupyter labextension build .",
|
|
33
|
-
"build:labextension:dev": "jupyter labextension build --development True .",
|
|
34
30
|
"build:lib": "tsc --sourceMap",
|
|
35
31
|
"build:lib:prod": "tsc",
|
|
36
32
|
"clean": "jlpm clean:lib",
|
|
37
33
|
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
|
|
38
|
-
"clean:
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"eslint": "jlpm eslint:check --fix",
|
|
42
|
-
"eslint:check": "eslint . --cache --ext .ts,.tsx",
|
|
43
|
-
"install:extension": "jlpm build",
|
|
44
|
-
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
|
|
45
|
-
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
|
|
46
|
-
"prettier": "jlpm prettier:base --write --list-different",
|
|
47
|
-
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
|
|
48
|
-
"prettier:check": "jlpm prettier:base --check",
|
|
49
|
-
"stylelint": "jlpm stylelint:check --fix",
|
|
50
|
-
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
|
|
51
|
-
"watch": "run-p watch:src watch:labextension",
|
|
52
|
-
"watch:src": "tsc -w --sourceMap",
|
|
53
|
-
"watch:labextension": "jupyter labextension watch ."
|
|
34
|
+
"clean:all": "jlpm clean:lib",
|
|
35
|
+
"watch": "run-p watch:src",
|
|
36
|
+
"watch:src": "tsc -w --sourceMap"
|
|
54
37
|
},
|
|
55
38
|
"dependencies": {
|
|
56
39
|
"@jupyterlab/coreutils": "^6",
|
|
@@ -68,148 +51,15 @@
|
|
|
68
51
|
"@types/json-schema": "^7.0.11",
|
|
69
52
|
"@types/react": "^18.0.26",
|
|
70
53
|
"@types/react-addons-linked-state-mixin": "^0.14.22",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
72
|
-
"@typescript-eslint/parser": "^6.1.0",
|
|
73
|
-
"css-loader": "^6.7.1",
|
|
74
|
-
"eslint": "^8.36.0",
|
|
75
|
-
"eslint-config-prettier": "^8.8.0",
|
|
76
|
-
"eslint-plugin-prettier": "^5.0.0",
|
|
77
54
|
"npm-run-all": "^4.1.5",
|
|
78
|
-
"prettier": "^3.0.0",
|
|
79
55
|
"rimraf": "^5.0.1",
|
|
80
56
|
"source-map-loader": "^1.0.2",
|
|
81
|
-
"style-loader": "^3.3.1",
|
|
82
|
-
"stylelint": "^15.10.1",
|
|
83
|
-
"stylelint-config-recommended": "^13.0.0",
|
|
84
|
-
"stylelint-config-standard": "^34.0.0",
|
|
85
|
-
"stylelint-csstree-validator": "^3.0.0",
|
|
86
|
-
"stylelint-prettier": "^4.0.0",
|
|
87
57
|
"ts-loader": "^9.2.6",
|
|
88
58
|
"typescript": "~5.0.2",
|
|
89
59
|
"webpack": "^5.87.0",
|
|
90
60
|
"yjs": "^13.5.0"
|
|
91
61
|
},
|
|
92
|
-
"sideEffects": [
|
|
93
|
-
"style/*.css",
|
|
94
|
-
"style/index.js"
|
|
95
|
-
],
|
|
96
|
-
"styleModule": "style/index.js",
|
|
97
62
|
"publishConfig": {
|
|
98
63
|
"access": "public"
|
|
99
|
-
},
|
|
100
|
-
"jupyterlab": {
|
|
101
|
-
"extension": true,
|
|
102
|
-
"outputDir": "jupyterlite_xeus/labextension",
|
|
103
|
-
"sharedPackages": {
|
|
104
|
-
"@jupyterlite/kernel": {
|
|
105
|
-
"bundled": false,
|
|
106
|
-
"singleton": true
|
|
107
|
-
},
|
|
108
|
-
"@jupyterlite/server": {
|
|
109
|
-
"bundled": false,
|
|
110
|
-
"singleton": true
|
|
111
|
-
},
|
|
112
|
-
"@jupyterlite/contents": {
|
|
113
|
-
"bundled": false,
|
|
114
|
-
"singleton": true
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"jupyterlite": {
|
|
119
|
-
"liteExtension": true
|
|
120
|
-
},
|
|
121
|
-
"eslintIgnore": [
|
|
122
|
-
"node_modules",
|
|
123
|
-
"dist",
|
|
124
|
-
"coverage",
|
|
125
|
-
"**/*.d.ts",
|
|
126
|
-
"tests",
|
|
127
|
-
"**/__tests__",
|
|
128
|
-
"ui-tests"
|
|
129
|
-
],
|
|
130
|
-
"eslintConfig": {
|
|
131
|
-
"extends": [
|
|
132
|
-
"eslint:recommended",
|
|
133
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
134
|
-
"plugin:@typescript-eslint/recommended",
|
|
135
|
-
"plugin:prettier/recommended"
|
|
136
|
-
],
|
|
137
|
-
"parser": "@typescript-eslint/parser",
|
|
138
|
-
"parserOptions": {
|
|
139
|
-
"project": "tsconfig.json",
|
|
140
|
-
"sourceType": "module"
|
|
141
|
-
},
|
|
142
|
-
"plugins": [
|
|
143
|
-
"@typescript-eslint"
|
|
144
|
-
],
|
|
145
|
-
"rules": {
|
|
146
|
-
"@typescript-eslint/naming-convention": [
|
|
147
|
-
"error",
|
|
148
|
-
{
|
|
149
|
-
"selector": "interface",
|
|
150
|
-
"format": [
|
|
151
|
-
"PascalCase"
|
|
152
|
-
],
|
|
153
|
-
"custom": {
|
|
154
|
-
"regex": "^I[A-Z]",
|
|
155
|
-
"match": true
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
],
|
|
159
|
-
"@typescript-eslint/no-unused-vars": [
|
|
160
|
-
"warn",
|
|
161
|
-
{
|
|
162
|
-
"args": "none"
|
|
163
|
-
}
|
|
164
|
-
],
|
|
165
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
166
|
-
"@typescript-eslint/no-namespace": "off",
|
|
167
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
168
|
-
"@typescript-eslint/quotes": [
|
|
169
|
-
"error",
|
|
170
|
-
"single",
|
|
171
|
-
{
|
|
172
|
-
"avoidEscape": true,
|
|
173
|
-
"allowTemplateLiterals": false
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
"curly": [
|
|
177
|
-
"error",
|
|
178
|
-
"all"
|
|
179
|
-
],
|
|
180
|
-
"eqeqeq": "error",
|
|
181
|
-
"prefer-arrow-callback": "error"
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
"prettier": {
|
|
185
|
-
"singleQuote": true,
|
|
186
|
-
"trailingComma": "none",
|
|
187
|
-
"arrowParens": "avoid",
|
|
188
|
-
"endOfLine": "auto",
|
|
189
|
-
"overrides": [
|
|
190
|
-
{
|
|
191
|
-
"files": "package.json",
|
|
192
|
-
"options": {
|
|
193
|
-
"tabWidth": 4
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
]
|
|
197
|
-
},
|
|
198
|
-
"stylelint": {
|
|
199
|
-
"extends": [
|
|
200
|
-
"stylelint-config-recommended",
|
|
201
|
-
"stylelint-config-standard",
|
|
202
|
-
"stylelint-prettier/recommended"
|
|
203
|
-
],
|
|
204
|
-
"plugins": [
|
|
205
|
-
"stylelint-csstree-validator"
|
|
206
|
-
],
|
|
207
|
-
"rules": {
|
|
208
|
-
"csstree/validator": true,
|
|
209
|
-
"property-no-vendor-prefix": null,
|
|
210
|
-
"selector-class-pattern": "^([a-z][A-z\\d]*)(-[A-z\\d]+)*$",
|
|
211
|
-
"selector-no-vendor-prefix": null,
|
|
212
|
-
"value-no-vendor-prefix": null
|
|
213
|
-
}
|
|
214
64
|
}
|
|
215
65
|
}
|
package/LICENSE
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023, JupyterLite Contributors
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
# JupyterLite Xeus
|
|
2
|
-
|
|
3
|
-
[](https://github.com/jupyterlite/xeus/actions/workflows/build.yml)
|
|
4
|
-
|
|
5
|
-
JupyterLite loader for Xeus kernels
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
8
|
-
|
|
9
|
-
- JupyterLab >= 4.0.0
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
To install the extension, execute:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pip install jupyterlite_xeus
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
### From environment.yml
|
|
22
|
-
|
|
23
|
-
#### xeus-python kernel
|
|
24
|
-
|
|
25
|
-
To load a `xeus-python` kernel with a custom environment, create an `environment.yml` file with `xeus-python` and the desired dependencies. Here is an example with `numpy` as a additional dependency:
|
|
26
|
-
|
|
27
|
-
```yaml
|
|
28
|
-
name: xeus-lite-wasm
|
|
29
|
-
channels:
|
|
30
|
-
- https://repo.mamba.pm/emscripten-forge
|
|
31
|
-
- conda-forge
|
|
32
|
-
dependencies:
|
|
33
|
-
- xeus-python
|
|
34
|
-
- numpy
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
To build JupyterLite, run the following command where `environment.yml` is the path to the file you just created
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
jupyter lite build --XeusAddon.environment_file=some_path/to/environment.yml
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
#### xeus-lua / xeus-sqlite / xeus-\<mylang\>
|
|
44
|
-
|
|
45
|
-
To load a `xeus-lua` or `xeus-sqlite` kernel you can
|
|
46
|
-
do the same as above, just with
|
|
47
|
-
|
|
48
|
-
```yaml
|
|
49
|
-
dependencies:
|
|
50
|
-
- xeus-lua
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
or
|
|
54
|
-
|
|
55
|
-
```yaml
|
|
56
|
-
dependencies:
|
|
57
|
-
- xeus-sqlite
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Note that `xeus-sqlite` and `xeus-lua` do not support additional dependencies yet.
|
|
61
|
-
To build JupyterLite, run again:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
jupyter lite build --XeusAddon.environment_file=environment.yml
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### Multiple kernels
|
|
68
|
-
|
|
69
|
-
To create a deployment with multiple kernels, you can simply add them to the `environment.yml` file:
|
|
70
|
-
|
|
71
|
-
```yaml
|
|
72
|
-
name: xeus-lite-wasm
|
|
73
|
-
channels:
|
|
74
|
-
- https://repo.mamba.pm/emscripten-forge
|
|
75
|
-
- conda-forge
|
|
76
|
-
dependencies:
|
|
77
|
-
- xeus-python
|
|
78
|
-
- xeus-lua
|
|
79
|
-
- xeus-sqlite
|
|
80
|
-
- numpy
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### From local environment / prefix
|
|
84
|
-
|
|
85
|
-
When developing a xeus-kernel, it is very useful to be able to test it in JupyterLite without having to publish the kernel to emscripten-forge. Therefore, you can also use a local environment / prefix to build JupyterLite with a custom kernel.
|
|
86
|
-
|
|
87
|
-
#### Create a local environment / prefix
|
|
88
|
-
|
|
89
|
-
This workflow usually starts with creating a local conda environment / prefix for the `emscripten-wasm32` platform with all the dependencies required to build your kernel (here we install dependencies for `xeus-python`).
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
micromamba create -n xeus-python-dev \
|
|
93
|
-
--platform=emscripten-wasm32 \
|
|
94
|
-
-c https://repo.mamba.pm/emscripten-forge \
|
|
95
|
-
-c conda-forge \
|
|
96
|
-
--yes \
|
|
97
|
-
"python>=3.11" pybind11 nlohmann_json pybind11_json numpy pytest \
|
|
98
|
-
bzip2 sqlite zlib libffi xtl pyjs \
|
|
99
|
-
xeus xeus-lite
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
#### Build the kernel
|
|
103
|
-
|
|
104
|
-
This depends on your kernel, but it will look something like this:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
# path to your emscripten emsdk
|
|
108
|
-
source $EMSDK_DIR/emsdk_env.sh
|
|
109
|
-
|
|
110
|
-
WASM_ENV_NAME=xeus-python-dev
|
|
111
|
-
WASM_ENV_PREFIX=$MAMBA_ROOT_PREFIX/envs/$WASM_ENV_NAME
|
|
112
|
-
|
|
113
|
-
# let cmake know where the env is
|
|
114
|
-
export PREFIX=$WASM_ENV_PREFIX
|
|
115
|
-
export CMAKE_PREFIX_PATH=$PREFIX
|
|
116
|
-
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
|
|
117
|
-
|
|
118
|
-
cd /path/to/your/kernel/src
|
|
119
|
-
mkdir build_wasm
|
|
120
|
-
cd build_wasm
|
|
121
|
-
emcmake cmake \
|
|
122
|
-
-DCMAKE_BUILD_TYPE=Release \
|
|
123
|
-
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
|
|
124
|
-
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
|
125
|
-
..
|
|
126
|
-
emmake make -j8 install
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
#### Build the JupyterLite site
|
|
130
|
-
|
|
131
|
-
You will need to create a new environment with the dependencies to build the JupyterLite site.
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
# create new environment
|
|
135
|
-
micromamba create -n xeus-lite-host \
|
|
136
|
-
jupyterlite-core
|
|
137
|
-
|
|
138
|
-
# activate the environment
|
|
139
|
-
micromamba activate xeus-lite-host
|
|
140
|
-
|
|
141
|
-
# install jupyterlite_xeus via pip
|
|
142
|
-
python -m pip install jupyterlite-xeus
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
When running `jupyter lite build`, we pass the `prefix` option and point it to the local environment / prefix we just created:
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
jupyter lite build --XeusAddon.prefix=$WASM_ENV_PREFIX
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Mounting additional files
|
|
152
|
-
|
|
153
|
-
To copy additional files and directories into the virtual filesystem of the xeus-lite kernels you can use the `--XeusAddon.mount` option.
|
|
154
|
-
Each mount is specified as a pair of paths separated by a colon `:`. The first path is the path to the file or directory on the host machine, the second path is the path to the file or directory in the virtual filesystem of the kernel.
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
jupyter lite build \
|
|
158
|
-
--XeusAddon.environment_file=environment.yml \
|
|
159
|
-
--XeusAddon.mounts=/some/path/on/host_machine:/some/path/in/virtual/filesystem
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Contributing
|
|
163
|
-
|
|
164
|
-
### Development install from a conda / mamba environment
|
|
165
|
-
|
|
166
|
-
Create the conda environment with `conda`/`mamba`/`micromamba` (replace `micromamba` with `conda` or `mamba` according to your preference):
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
micromamba create -f environment-dev.yml -n xeus-lite-dev
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Activate the environment:
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
micromamba activate xeus-lite-dev
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
python -m pip install -e . -v --no-build-isolation
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Packaging the extension
|
|
183
|
-
|
|
184
|
-
See [RELEASE](RELEASE.md).
|
package/lib/tokens.js
DELETED
package/style/base.css
DELETED
package/style/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import url('base.css');
|
package/style/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './base.css';
|