Skip to content

Commit 669c79f

Browse files
krassowskidavidbrochart
authored andcommitted
Split up the backend, frontend, and the docprovider (jupyterlab#280)
* Split up the backend, frontend, and the docprovider * Fix LICENSE issue * Try a different way * Include LICENSE copies in git for simplicity * Test creating sdist for projects, not the root metapackage * Without concurrency * Fix sdist install * Include tests in `jupyter-server-ydoc` * Move test dependencies, align indent * Fix module name * Hopefully final test to sdist test * Only run pytest where needed * Add Python 3.12 version classifier Co-authored-by: David Brochart <[email protected]> * Implement independent version bumps, and minor/major/release specifiers * Bump all version to 3.0.0-alpha.0 * Reset versions for the three Python packages to 1.0.0a0 * Improve wording Co-authored-by: David Brochart <[email protected]> * Raise rather than assert --------- Co-authored-by: David Brochart <[email protected]>
1 parent aae4655 commit 669c79f

File tree

5 files changed

+5
-769
lines changed

5 files changed

+5
-769
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@
6767
"typedoc": "~0.23.28",
6868
"typescript": "~5.0.4"
6969
}
70-
}
70+
}

packages/collaboration-extension/src/collaboration.ts

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import { IGlobalAwareness } from '@jupyter/collaborative-drive';
1818
import { WebSocketAwarenessProvider } from '@jupyter/docprovider';
1919
import { SidePanel, usersIcon } from '@jupyterlab/ui-components';
20-
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
20+
import { URLExt } from '@jupyterlab/coreutils';
2121
import { ServerConnection } from '@jupyterlab/services';
2222
import { IStateDB, StateDB } from '@jupyterlab/statedb';
2323
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
@@ -190,63 +190,3 @@ export const userEditorCursors: JupyterFrontEndPlugin<void> = {
190190
});
191191
}
192192
};
193-
194-
export const notebookCellExecutor: JupyterFrontEndPlugin<INotebookCellExecutor> =
195-
{
196-
id: '@jupyter/collaboration-extension:notebook-cell-executor',
197-
description:
198-
'Add notebook cell executor that uses REST API instead of kernel protocol over WebSocket.',
199-
autoStart: true,
200-
provides: INotebookCellExecutor,
201-
activate: (app: JupyterFrontEnd): INotebookCellExecutor => {
202-
if (PageConfig.getOption('serverSideExecution') === 'true') {
203-
return Object.freeze({ runCell: runCellServerSide });
204-
}
205-
return Object.freeze({ runCell });
206-
}
207-
};
208-
209-
async function runCellServerSide({
210-
cell,
211-
notebook,
212-
notebookConfig,
213-
onCellExecuted,
214-
onCellExecutionScheduled,
215-
sessionContext,
216-
sessionDialogs,
217-
translator
218-
}: INotebookCellExecutor.IRunCellOptions): Promise<boolean> {
219-
switch (cell.model.type) {
220-
case 'markdown':
221-
(cell as MarkdownCell).rendered = true;
222-
cell.inputHidden = false;
223-
onCellExecuted({ cell, success: true });
224-
break;
225-
case 'code': {
226-
const kernelId = sessionContext?.session?.kernel?.id;
227-
const settings = ServerConnection.makeSettings();
228-
const apiURL = URLExt.join(
229-
settings.baseUrl,
230-
`api/kernels/${kernelId}/execute`
231-
);
232-
const cellId = cell.model.sharedModel.getId();
233-
const documentId = `json:notebook:${notebook.sharedModel.getState(
234-
'file_id'
235-
)}`;
236-
const body = `{"cell_id":"${cellId}","document_id":"${documentId}"}`;
237-
const init = {
238-
method: 'POST',
239-
body
240-
};
241-
try {
242-
await ServerConnection.makeRequest(apiURL, init, settings);
243-
} catch (error: any) {
244-
throw new ServerConnection.NetworkError(error);
245-
}
246-
break;
247-
}
248-
default:
249-
break;
250-
}
251-
return Promise.resolve(true);
252-
}

packages/collaboration-extension/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import {
1212
menuBarPlugin,
1313
rtcGlobalAwarenessPlugin,
1414
rtcPanelPlugin,
15-
userEditorCursors,
16-
notebookCellExecutor
15+
userEditorCursors
1716
} from './collaboration';
1817
import { sharedLink } from './sharedlink';
1918

@@ -26,8 +25,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
2625
rtcGlobalAwarenessPlugin,
2726
rtcPanelPlugin,
2827
sharedLink,
29-
userEditorCursors,
30-
notebookCellExecutor
28+
userEditorCursors
3129
];
3230

3331
export default plugins;

0 commit comments

Comments
 (0)