Skip to content

Commit

Permalink
Update to ipywidgets 8 / Notebook 7 / JupyterLab 4
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Sep 26, 2023
1 parent 1b1406d commit fa10e93
Show file tree
Hide file tree
Showing 22 changed files with 9,953 additions and 9,126 deletions.
2 changes: 2 additions & 0 deletions beakerx_widgets/js/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodeLinker: node-modules
enableImmutableInstalls: false
46 changes: 22 additions & 24 deletions beakerx_widgets/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
"url": "https://github.com/twosigma/beakerx_widgets.git"
},
"scripts": {
"build": "yarn run clean && yarn run build:css && yarn run build:js && webpack",
"build:css": "yarn run build:css:classic && yarn run build:css:lab",
"build": "jlpm run clean && jlpm run build:css && jlpm run build:js && webpack",
"build:css": "jlpm run build:css:classic && jlpm run build:css:lab",
"build:css:classic": "sass --no-source-map --load-path node_modules sass/beakerx_widgets.scss css/beakerx_widgets.css",
"build:css:lab": "sass --no-source-map --load-path node_modules sass/beakerx_widgets_lab.scss css/beakerx_widgets_lab.css",
"build:labextension": "yarn run build && jupyter labextension build .",
"build:labextension:dev": "yarn run build && jupyter labextension build --development True .",
"build:labextension": "jlpm run build && jupyter labextension build .",
"build:labextension:dev": "jlpm run build && jupyter labextension build --development True .",
"build:js": "tsc",
"watch": "run-p watch:js watch:webpack",
"watch:js": "tsc --watch",
"watch:webpack": "webpack --watch --progress",
"prepublish": "yarn run build",
"prepublish": "jlpm run build",
"test": "karma start --single-run",
"clean": "rimraf lib css dist ../beakerx/labextension",
"lint": "eslint src/ --ext .ts",
Expand All @@ -39,18 +39,9 @@
"prettier:fix": "prettier --check src/**/*.{ts,js} --write"
},
"devDependencies": {
"@jupyterlab/application": "^3.2.5",
"@jupyterlab/apputils": "^3.2.5",
"@jupyterlab/builder": "^3.2.5",
"@jupyterlab/cells": "^3.2.5",
"@jupyterlab/codemirror": "^3.2.5",
"@jupyterlab/coreutils": "^5.2.5",
"@jupyterlab/docregistry": "^3.2.5",
"@jupyterlab/notebook": "^3.2.5",
"@jupyterlab/settingregistry": "^3.2.5",
"@jupyterlab/builder": "^4",
"@types/big.js": "^4.0.5",
"@types/chai": "^4.2.11",
"@types/codemirror": "^0.0.76",
"@types/d3": "^5.7.2",
"@types/expect.js": "^0.3.29",
"@types/jquery": "^3.3.38",
Expand All @@ -71,20 +62,27 @@
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"style-loader": "^1.2.1",
"typescript": "^3.9.7",
"typescript": "^5",
"url-loader": "^4.1.0",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.11"
},
"dependencies": {
"@jupyter-widgets/base": "^4.0.0",
"@jupyter-widgets/controls": "^3.0.0",
"@lumino/commands": "^1.12.0",
"@lumino/coreutils": "^1.5.3",
"@lumino/disposable": "^1.4.3",
"@lumino/messaging": "^1.4.3",
"@lumino/signaling": "^1.4.3",
"@lumino/widgets": "^1.18.0",
"@jupyter-widgets/base": "^4 || ^6",
"@jupyter-widgets/controls": "^3 || ^5",
"@jupyterlab/application": "^3.2.5 || ^4",
"@jupyterlab/apputils": "^3.2.5 || ^4",
"@jupyterlab/cells": "^3.2.5 || ^4",
"@jupyterlab/coreutils": "^5.2.5 || ^6",
"@jupyterlab/docregistry": "^3.2.5 || ^4",
"@jupyterlab/notebook": "^3.2.5 || ^4",
"@jupyterlab/settingregistry": "^3.2.5 || ^4",
"@lumino/commands": "^1 || ^2",
"@lumino/coreutils": "^1 || ^2",
"@lumino/disposable": "^1 || ^2",
"@lumino/messaging": "^1 || ^2",
"@lumino/signaling": "^1 || ^2",
"@lumino/widgets": "^1 || ^2",
"big.js": "^5.2.2",
"d3": "^5.16.0",
"flatpickr": "^4.6.3",
Expand Down
121 changes: 0 additions & 121 deletions beakerx_widgets/js/src/extension/codeEditor.ts

This file was deleted.

4 changes: 0 additions & 4 deletions beakerx_widgets/js/src/extension/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// It contains some requirejs configuration and the `load_ipython_extension`
// which is required for any notebook extension.

import { extendHighlightModes, extendWithLineComment } from './codeEditor';
import { registerFeature } from './UIOptionsHelper';
import { enableInitializationCellsFeature } from './initializationCells';
import { AutoTranslation } from './autoTranslation';
Expand Down Expand Up @@ -97,9 +96,6 @@ function setupNotebook() {
.catch((reason) => {
console.error(log_prefix, 'unhandled error:', reason);
});

extendWithLineComment(Jupyter, CodeMirror);
extendHighlightModes(Jupyter);
}

export function load_ipython_extension(): void {
Expand Down
8 changes: 1 addition & 7 deletions beakerx_widgets/js/src/jupyterlab-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,6 @@ export const TreePlugin: JupyterFrontEndPlugin<void> = {
autoStart: true,
};


const plugins: JupyterFrontEndPlugin<any>[] = [
BeakexWidgetsFormsPlugin,
RequireJsPlugin,
BigJsPlugin,
TreePlugin
];
const plugins: JupyterFrontEndPlugin<any>[] = [BeakexWidgetsFormsPlugin, RequireJsPlugin, BigJsPlugin, TreePlugin];

export default plugins;
4 changes: 0 additions & 4 deletions beakerx_widgets/js/src/lab/BeakerxWidgetExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import { DisposableDelegate } from '@lumino/disposable';
import { bkCoreManager } from '../utils/bk/bkCoreManager';
import {
enableInitializationCellsFeature,
extendHighlightModes,
registerCommentOutCmd,
registerCommTargets,
UIOptionFeaturesHelper,
} from './plugin';
Expand All @@ -40,9 +38,7 @@ export class BeakerxWidgetExtension implements DocumentRegistry.WidgetExtension
const labShell = this.labShell;

Promise.all([panel.sessionContext.ready, context.ready]).then(function () {
extendHighlightModes(panel);
enableInitializationCellsFeature(panel);
registerCommentOutCmd(panel);
registerCommTargets(panel, context);

window.beakerxHolder = window.beakerxHolder || {};
Expand Down
3 changes: 2 additions & 1 deletion beakerx_widgets/js/src/lab/plugin/codeCells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export function getCodeCellsByTag(notebook: Notebook, tag: string): Cell[] {
const cells = notebook.widgets || [];

return cells.filter((cell) => {
const tags: any = cell.model.metadata.get('tags');
// @ts-ignore: Support for both JupyterLab 3 and 4. It does not compile against JupyterLab 4.
const tags: any = cell.model.getMetadata ? cell.model.getMetadata('tags') : cell.model.metadata.get('tags');

return cell.model instanceof CodeCellModel && tags && tags.length && tags.includes(tag);
});
Expand Down
116 changes: 0 additions & 116 deletions beakerx_widgets/js/src/lab/plugin/codeEditor.ts

This file was deleted.

4 changes: 1 addition & 3 deletions beakerx_widgets/js/src/lab/plugin/gistPublish/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ function addActionButton(panel: NotebookPanel, commands: CommandRegistry): void
}

function removeActionButton(panel: NotebookPanel): void {
const iter = panel.toolbar.layout.iter();
let widget;
while ((widget = iter.next())) {
for (const widget of panel.toolbar.layout) {
if (widget instanceof ToolbarButton && widget.id == 'bx-publishButton') {
panel.toolbar.layout.removeWidget(widget);
break;
Expand Down
Loading

0 comments on commit fa10e93

Please sign in to comment.