From b76c1c2a2eb5d7f3cd7611efc3f804afaf449e29 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Mon, 19 Aug 2024 11:56:33 +0200 Subject: [PATCH] Phosphore widget backward compatibility fix on WidgetRenderer --- docs/requirements.txt | 4 +- packages/base/src/widget.ts | 5 ++ python/jupyterlab_widgets/src/renderer.ts | 3 +- yarn.lock | 66 +++++++++++------------ 4 files changed, 42 insertions(+), 36 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 922711b316..4c431f62ba 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -6,8 +6,8 @@ ipyleaflet jupyter-client jupyter-packaging jupyterlab >=4 -jupyterlite-core >=0.3.0<0.4.0 -jupyterlite-pyodide-kernel >=0.3.0<0.4.0 +jupyterlite-core >=0.3.0,<0.4.0 +jupyterlite-pyodide-kernel >=0.3.0,<0.4.0 matplotlib myst-nb >=0.17,<0.18 numpy diff --git a/packages/base/src/widget.ts b/packages/base/src/widget.ts index aea060fc8d..a187730d8b 100644 --- a/packages/base/src/widget.ts +++ b/packages/base/src/widget.ts @@ -983,6 +983,11 @@ export class JupyterLuminoPanelWidget extends Panel { private _view: DOMWidgetView; } +/** + * @deprecated Use {@link JupyterLuminoPanelWidget} instead (Since 8.0). + */ +export const JupyterPhosphorPanelWidget = JupyterLuminoPanelWidget; + export class DOMWidgetView extends WidgetView { /** * Public constructor diff --git a/python/jupyterlab_widgets/src/renderer.ts b/python/jupyterlab_widgets/src/renderer.ts index 1e0aa34f37..ce0d257625 100644 --- a/python/jupyterlab_widgets/src/renderer.ts +++ b/python/jupyterlab_widgets/src/renderer.ts @@ -74,7 +74,8 @@ export class WidgetRenderer let widget: LuminoWidget; try { - widget = (await manager.create_view(wModel)).luminoWidget; + const view = await manager.create_view(wModel); + widget = view.luminoWidget || view.pWidget; } catch (err) { this.node.textContent = 'Error displaying widget'; this.addClass('jupyter-widgets'); diff --git a/yarn.lock b/yarn.lock index 3cf819b206..dce4d8e913 100644 --- a/yarn.lock +++ b/yarn.lock @@ -732,11 +732,11 @@ __metadata: languageName: node linkType: hard -"@jupyter-widgets/base-manager@^1.0.8, @jupyter-widgets/base-manager@workspace:packages/base-manager": +"@jupyter-widgets/base-manager@^1.0.9, @jupyter-widgets/base-manager@workspace:packages/base-manager": version: 0.0.0-use.local resolution: "@jupyter-widgets/base-manager@workspace:packages/base-manager" dependencies: - "@jupyter-widgets/base": ^6.0.7 + "@jupyter-widgets/base": ^6.0.8 "@jupyterlab/services": ^6.0.0 || ^7.0.0 "@lumino/coreutils": ^1.11.1 || ^2 "@types/base64-js": ^1.2.5 @@ -771,7 +771,7 @@ __metadata: languageName: unknown linkType: soft -"@jupyter-widgets/base@^6.0.7, @jupyter-widgets/base@workspace:packages/base": +"@jupyter-widgets/base@^6.0.8, @jupyter-widgets/base@workspace:packages/base": version: 0.0.0-use.local resolution: "@jupyter-widgets/base@workspace:packages/base" dependencies: @@ -814,11 +814,11 @@ __metadata: languageName: unknown linkType: soft -"@jupyter-widgets/controls@^5.0.8, @jupyter-widgets/controls@workspace:packages/controls": +"@jupyter-widgets/controls@^5.0.9, @jupyter-widgets/controls@workspace:packages/controls": version: 0.0.0-use.local resolution: "@jupyter-widgets/controls@workspace:packages/controls" dependencies: - "@jupyter-widgets/base": ^6.0.7 + "@jupyter-widgets/base": ^6.0.8 "@jupyterlab/services": ^6.0.0 || ^7.0.0 "@lumino/algorithm": ^1.9.1 || ^2.1 "@lumino/domutils": ^1.8.1 || ^2.1 @@ -869,9 +869,9 @@ __metadata: version: 0.0.0-use.local resolution: "@jupyter-widgets/example-web1@workspace:examples/web1" dependencies: - "@jupyter-widgets/base": ^6.0.7 - "@jupyter-widgets/base-manager": ^1.0.8 - "@jupyter-widgets/controls": ^5.0.8 + "@jupyter-widgets/base": ^6.0.8 + "@jupyter-widgets/base-manager": ^1.0.9 + "@jupyter-widgets/controls": ^5.0.9 chai: ^4.0.0 css-loader: ^6.5.1 karma: ^6.3.3 @@ -890,9 +890,9 @@ __metadata: version: 0.0.0-use.local resolution: "@jupyter-widgets/example-web2@workspace:examples/web2" dependencies: - "@jupyter-widgets/base": ^6.0.7 - "@jupyter-widgets/base-manager": ^1.0.8 - "@jupyter-widgets/controls": ^5.0.8 + "@jupyter-widgets/base": ^6.0.8 + "@jupyter-widgets/base-manager": ^1.0.9 + "@jupyter-widgets/controls": ^5.0.9 codemirror: ^5.48.0 css-loader: ^6.5.1 font-awesome: ^4.7.0 @@ -905,9 +905,9 @@ __metadata: version: 0.0.0-use.local resolution: "@jupyter-widgets/example-web3@workspace:examples/web3" dependencies: - "@jupyter-widgets/base": ^6.0.7 - "@jupyter-widgets/controls": ^5.0.8 - "@jupyter-widgets/html-manager": ^1.0.10 + "@jupyter-widgets/base": ^6.0.8 + "@jupyter-widgets/controls": ^5.0.9 + "@jupyter-widgets/html-manager": ^1.0.11 "@jupyterlab/services": ^6.0.0 || ^7.0.0 "@types/codemirror": ^5.60.0 "@types/node": ^17.0.2 @@ -927,7 +927,7 @@ __metadata: version: 0.0.0-use.local resolution: "@jupyter-widgets/example-web4@workspace:examples/web4" dependencies: - "@jupyter-widgets/html-manager": ^1.0.10 + "@jupyter-widgets/html-manager": ^1.0.11 css-loader: ^6.5.1 font-awesome: ^4.7.0 style-loader: ^3.3.1 @@ -935,16 +935,16 @@ __metadata: languageName: unknown linkType: soft -"@jupyter-widgets/html-manager@^1.0.10, @jupyter-widgets/html-manager@workspace:packages/html-manager": +"@jupyter-widgets/html-manager@^1.0.11, @jupyter-widgets/html-manager@workspace:packages/html-manager": version: 0.0.0-use.local resolution: "@jupyter-widgets/html-manager@workspace:packages/html-manager" dependencies: "@fortawesome/fontawesome-free": ^5.12.0 - "@jupyter-widgets/base": ^6.0.7 - "@jupyter-widgets/base-manager": ^1.0.8 - "@jupyter-widgets/controls": ^5.0.8 - "@jupyter-widgets/output": ^6.0.7 - "@jupyter-widgets/schema": ^0.5.4 + "@jupyter-widgets/base": ^6.0.8 + "@jupyter-widgets/base-manager": ^1.0.9 + "@jupyter-widgets/controls": ^5.0.9 + "@jupyter-widgets/output": ^6.0.8 + "@jupyter-widgets/schema": ^0.5.5 "@jupyterlab/outputarea": ^3.0.0 || ^4.0.0 "@jupyterlab/rendermime": ^3.0.0 || ^4.0.0 "@jupyterlab/rendermime-interfaces": ^3.0.0 || ^4.0.0 @@ -981,10 +981,10 @@ __metadata: version: 0.0.0-use.local resolution: "@jupyter-widgets/jupyterlab-manager@workspace:python/jupyterlab_widgets" dependencies: - "@jupyter-widgets/base": ^6.0.7 - "@jupyter-widgets/base-manager": ^1.0.8 - "@jupyter-widgets/controls": ^5.0.8 - "@jupyter-widgets/output": ^6.0.7 + "@jupyter-widgets/base": ^6.0.8 + "@jupyter-widgets/base-manager": ^1.0.9 + "@jupyter-widgets/controls": ^5.0.9 + "@jupyter-widgets/output": ^6.0.8 "@jupyterlab/application": ^3.0.0 || ^4.0.0 "@jupyterlab/apputils": ^3.0.0 || ^4.0.0 "@jupyterlab/builder": ^3.0.0 || ^4.0.0 @@ -1028,11 +1028,11 @@ __metadata: version: 0.0.0-use.local resolution: "@jupyter-widgets/notebook-manager@workspace:python/widgetsnbextension" dependencies: - "@jupyter-widgets/base": ^6.0.7 - "@jupyter-widgets/base-manager": ^1.0.8 - "@jupyter-widgets/controls": ^5.0.8 - "@jupyter-widgets/html-manager": ^1.0.10 - "@jupyter-widgets/output": ^6.0.7 + "@jupyter-widgets/base": ^6.0.8 + "@jupyter-widgets/base-manager": ^1.0.9 + "@jupyter-widgets/controls": ^5.0.9 + "@jupyter-widgets/html-manager": ^1.0.11 + "@jupyter-widgets/output": ^6.0.8 "@jupyterlab/services": ^6.0.0 || ^7.0.0 "@lumino/messaging": ^1.10.1 || ^2.1 "@lumino/widgets": ^1.30.0 || ^2.1 @@ -1046,17 +1046,17 @@ __metadata: languageName: unknown linkType: soft -"@jupyter-widgets/output@^6.0.7, @jupyter-widgets/output@workspace:packages/output": +"@jupyter-widgets/output@^6.0.8, @jupyter-widgets/output@workspace:packages/output": version: 0.0.0-use.local resolution: "@jupyter-widgets/output@workspace:packages/output" dependencies: - "@jupyter-widgets/base": ^6.0.7 + "@jupyter-widgets/base": ^6.0.8 rimraf: ^3.0.2 typescript: ~4.9.4 languageName: unknown linkType: soft -"@jupyter-widgets/schema@^0.5.4, @jupyter-widgets/schema@workspace:packages/schema": +"@jupyter-widgets/schema@^0.5.5, @jupyter-widgets/schema@workspace:packages/schema": version: 0.0.0-use.local resolution: "@jupyter-widgets/schema@workspace:packages/schema" languageName: unknown