Skip to content

Commit 5ad1b1d

Browse files
Add backward compatibility for ipywidgets 7 (#1501)
* Widgets managers * Iterate * Iterate * Iterate * Something that compiles * Iterate * console in shared scope * Polling in shared scope * statedb in sharedscope * Iterate * Run linter * Iterate * Figure out from the server the widgets version that should be injected This has the downside of not letting the kernel decide the widgets version, which is a regression from Voila 0.4.x. But that should be fine. * Working solution with ipywidgets 7 * Linting * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UI-tests with ipywidgets 7 * Try fixing ui-tests for 7 * Artifacts names * arf * Fix report name + output widget * Update artifacts names * Fix progressive rendering logic for ipywidgets 7 * Remove any * Linter * Add docs about the new labextensions path --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6f45057 commit 5ad1b1d

37 files changed

+3564
-2644
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ node_modules
66
**/node_modules
77
**/mock_packages
88
**/static
9-
**/labextension
9+
**/labextensions
1010
**/typings
1111
**/schemas
1212
**/themes

.github/workflows/ui-tests.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
matrix:
1515
jupyter-server-version: ['1.24.0', '2.14.2']
1616
progressive_rendering: [false, true]
17+
ipywidgets: ['latest', '7']
1718
exclude:
1819
- jupyter-server-version: '1.24.0'
1920
progressive_rendering: true
@@ -25,6 +26,7 @@ jobs:
2526
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
2627

2728
- name: Install dependencies
29+
if: ${{ matrix.ipywidgets == 'latest' }}
2830
run: |
2931
python -m pip install -r requirements-visual-test.txt
3032
python -m pip install jupyterlab_miami_nights --no-deps
@@ -36,6 +38,19 @@ jobs:
3638
cd ui-tests
3739
jlpm install
3840
41+
- name: Install dependencies
42+
if: ${{ matrix.ipywidgets == '7' }}
43+
run: |
44+
python -m pip install -r requirements-visual-test.txt
45+
python -m pip install jupyterlab_miami_nights --no-deps
46+
python -m pip install ".[test7]"
47+
python -m pip install jupyter-server==${{ matrix.jupyter-server-version }}
48+
jlpm
49+
jlpm build
50+
jupyter labextension develop . --overwrite
51+
cd ui-tests
52+
jlpm install
53+
3954
- name: Launch Voila
4055
run: |
4156
# Mount a volume to overwrite the server configuration
@@ -61,16 +76,16 @@ jobs:
6176
- name: Set test report name for progressive rendering
6277
if: always() && matrix.progressive_rendering == true
6378
run: |
64-
echo "TEST_REPORT_NAME=progressive-voila-test-report-${{ matrix.jupyter-server-version }}" >> $GITHUB_ENV
65-
echo "TEST_ASSETS_NAME=progressive-voila-test-assets-${{ matrix.jupyter-server-version }}" >> $GITHUB_ENV
66-
echo "TEST_BENCHMARK_NAME=progressive-voila-test-benchmark-${{ matrix.jupyter-server-version }}" >> $GITHUB_ENV
79+
echo "TEST_REPORT_NAME=progressive-voila-test-report-server_${{ matrix.jupyter-server-version }}-ipywidget_${{ matrix.ipywidgets }}" >> $GITHUB_ENV
80+
echo "TEST_ASSETS_NAME=progressive-voila-test-assets-server_${{ matrix.jupyter-server-version }}-ipywidget_${{ matrix.ipywidgets }}" >> $GITHUB_ENV
81+
echo "TEST_BENCHMARK_NAME=progressive-voila-test-benchmark-server_${{ matrix.jupyter-server-version }}-ipywidget_${{ matrix.ipywidgets }}" >> $GITHUB_ENV
6782
6883
- name: Set test report name for non-progressive rendering
6984
if: always() && matrix.progressive_rendering == false
7085
run: |
71-
echo "TEST_REPORT_NAME=voila-test-report-${{ matrix.jupyter-server-version }}" >> $GITHUB_ENV
72-
echo "TEST_ASSETS_NAME=voila-test-assets-${{ matrix.jupyter-server-version }}" >> $GITHUB_ENV
73-
echo "TEST_BENCHMARK_NAME=voila-test-benchmark-${{ matrix.jupyter-server-version }}" >> $GITHUB_ENV
86+
echo "TEST_REPORT_NAME=voila-test-report-server_${{ matrix.jupyter-server-version }}-ipywidget_${{ matrix.ipywidgets }}" >> $GITHUB_ENV
87+
echo "TEST_ASSETS_NAME=voila-test-assets-server_${{ matrix.jupyter-server-version }}-ipywidget_${{ matrix.ipywidgets }}" >> $GITHUB_ENV
88+
echo "TEST_BENCHMARK_NAME=voila-test-benchmark-server_${{ matrix.jupyter-server-version }}-ipywidget_${{ matrix.ipywidgets }}" >> $GITHUB_ENV
7489
7590
- name: Upload Playwright Test assets
7691
if: always()

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ share/jupyter/voila/templates/base/static/*.LICENSE.txt
4444

4545
lib
4646

47-
voila/labextension
47+
voila/labextensions
4848
tsconfig.tsbuildinfo
4949

5050
ui-tests/playwright-report

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ node_modules
22
**/node_modules
33
**/lib
44
**/package.json
5-
**/labextension
5+
**/labextensions
66
**/static
77
build
88
notebooks/

docs/customize.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,3 +759,12 @@ or using `voila.json` file
759759
:::{warning}
760760
Progressive rendering mode is incompatible with the preheated kernels functionality.
761761
:::
762+
763+
## Custom labextension for Voila
764+
765+
Since Voila 0.5.0, it can now load JupyterLab extensions. Allowing to load custom mimetype extensions, JupyterLab themes etc.
766+
767+
Voila will load all extensions under `{PREFIX}/share/jupyter/labextensions` just like JupyterLab and Jupyter Notebook v7.
768+
769+
It also has its own path for labextensions that you can use: `{PREFIX}/share/jupyter/voila/labextensions`. Installing extensions there will make those extensions only available to Voila. This is really useful if you
770+
don't want to pollute JupyterLab or Jupyter Notebook with extensions that only work for Voila.

package.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,133 @@
4545
"prettier": "^2.8.6",
4646
"rimraf": "^3.0.2",
4747
"shell-quote": "^1.7.2"
48+
},
49+
"resolutions": {
50+
"@codemirror/language": "^6.0.0",
51+
"@codemirror/state": "^6.2.0",
52+
"@codemirror/view": "^6.9.6",
53+
"@jupyter/react-components": "^0.15.3",
54+
"@jupyter/web-components": "^0.15.3",
55+
"@jupyter/ydoc": "^2.0.1",
56+
"@jupyterlab/application": "~4.2.5",
57+
"@jupyterlab/application-extension": "~4.2.5",
58+
"@jupyterlab/apputils": "~4.3.5",
59+
"@jupyterlab/apputils-extension": "~4.2.5",
60+
"@jupyterlab/attachments": "~4.2.5",
61+
"@jupyterlab/cell-toolbar": "~4.2.5",
62+
"@jupyterlab/cell-toolbar-extension": "~4.2.5",
63+
"@jupyterlab/cells": "~4.2.5",
64+
"@jupyterlab/celltags-extension": "~4.2.5",
65+
"@jupyterlab/codeeditor": "~4.2.5",
66+
"@jupyterlab/codemirror": "~4.2.5",
67+
"@jupyterlab/codemirror-extension": "~4.2.5",
68+
"@jupyterlab/completer": "~4.2.5",
69+
"@jupyterlab/completer-extension": "~4.2.5",
70+
"@jupyterlab/console": "~4.2.5",
71+
"@jupyterlab/console-extension": "~4.2.5",
72+
"@jupyterlab/coreutils": "~6.2.5",
73+
"@jupyterlab/csvviewer": "~4.2.5",
74+
"@jupyterlab/csvviewer-extension": "~4.2.5",
75+
"@jupyterlab/debugger": "~4.2.5",
76+
"@jupyterlab/debugger-extension": "~4.2.5",
77+
"@jupyterlab/docmanager": "~4.2.5",
78+
"@jupyterlab/docmanager-extension": "~4.2.5",
79+
"@jupyterlab/docregistry": "~4.2.5",
80+
"@jupyterlab/documentsearch": "~4.2.5",
81+
"@jupyterlab/documentsearch-extension": "~4.2.5",
82+
"@jupyterlab/extensionmanager": "~4.2.5",
83+
"@jupyterlab/extensionmanager-extension": "~4.2.5",
84+
"@jupyterlab/filebrowser": "~4.2.5",
85+
"@jupyterlab/filebrowser-extension": "~4.2.5",
86+
"@jupyterlab/fileeditor": "~4.2.5",
87+
"@jupyterlab/fileeditor-extension": "~4.2.5",
88+
"@jupyterlab/help-extension": "~4.2.5",
89+
"@jupyterlab/htmlviewer": "~4.2.5",
90+
"@jupyterlab/htmlviewer-extension": "~4.2.5",
91+
"@jupyterlab/hub-extension": "~4.2.5",
92+
"@jupyterlab/imageviewer": "~4.2.5",
93+
"@jupyterlab/imageviewer-extension": "~4.2.5",
94+
"@jupyterlab/inspector": "~4.2.5",
95+
"@jupyterlab/inspector-extension": "~4.2.5",
96+
"@jupyterlab/javascript-extension": "~4.2.5",
97+
"@jupyterlab/json-extension": "~4.2.5",
98+
"@jupyterlab/launcher": "~4.2.5",
99+
"@jupyterlab/launcher-extension": "~4.2.5",
100+
"@jupyterlab/logconsole": "~4.2.5",
101+
"@jupyterlab/logconsole-extension": "~4.2.5",
102+
"@jupyterlab/lsp": "~4.2.5",
103+
"@jupyterlab/lsp-extension": "~4.2.5",
104+
"@jupyterlab/mainmenu": "~4.2.5",
105+
"@jupyterlab/mainmenu-extension": "~4.2.5",
106+
"@jupyterlab/markdownviewer": "~4.2.5",
107+
"@jupyterlab/markdownviewer-extension": "~4.2.5",
108+
"@jupyterlab/markedparser-extension": "~4.2.5",
109+
"@jupyterlab/mathjax-extension": "~4.2.5",
110+
"@jupyterlab/mermaid": "~4.2.5",
111+
"@jupyterlab/mermaid-extension": "~4.2.5",
112+
"@jupyterlab/metadataform": "~4.2.5",
113+
"@jupyterlab/metadataform-extension": "~4.2.5",
114+
"@jupyterlab/metapackage": "~4.2.5",
115+
"@jupyterlab/nbconvert-css": "~4.2.5",
116+
"@jupyterlab/nbformat": "~4.2.5",
117+
"@jupyterlab/notebook": "~4.2.5",
118+
"@jupyterlab/notebook-extension": "~4.2.5",
119+
"@jupyterlab/observables": "~5.2.5",
120+
"@jupyterlab/outputarea": "~4.2.5",
121+
"@jupyterlab/pdf-extension": "~4.2.5",
122+
"@jupyterlab/pluginmanager": "~4.2.5",
123+
"@jupyterlab/pluginmanager-extension": "~4.2.5",
124+
"@jupyterlab/property-inspector": "~4.2.5",
125+
"@jupyterlab/rendermime": "~4.2.5",
126+
"@jupyterlab/rendermime-extension": "~4.2.5",
127+
"@jupyterlab/rendermime-interfaces": "~3.10.5",
128+
"@jupyterlab/running": "~4.2.5",
129+
"@jupyterlab/running-extension": "~4.2.5",
130+
"@jupyterlab/services": "~7.2.5",
131+
"@jupyterlab/settingeditor": "~4.2.5",
132+
"@jupyterlab/settingeditor-extension": "~4.2.5",
133+
"@jupyterlab/settingregistry": "~4.2.5",
134+
"@jupyterlab/shortcuts-extension": "~5.0.5",
135+
"@jupyterlab/statedb": "~4.2.5",
136+
"@jupyterlab/statusbar": "~4.2.5",
137+
"@jupyterlab/statusbar-extension": "~4.2.5",
138+
"@jupyterlab/terminal": "~4.2.5",
139+
"@jupyterlab/terminal-extension": "~4.2.5",
140+
"@jupyterlab/theme-dark-extension": "~4.2.5",
141+
"@jupyterlab/theme-dark-high-contrast-extension": "~4.2.5",
142+
"@jupyterlab/theme-light-extension": "~4.2.5",
143+
"@jupyterlab/toc": "~6.2.5",
144+
"@jupyterlab/toc-extension": "~6.2.5",
145+
"@jupyterlab/tooltip": "~4.2.5",
146+
"@jupyterlab/tooltip-extension": "~4.2.5",
147+
"@jupyterlab/translation": "~4.2.5",
148+
"@jupyterlab/translation-extension": "~4.2.5",
149+
"@jupyterlab/ui-components": "~4.2.5",
150+
"@jupyterlab/ui-components-extension": "~4.2.5",
151+
"@jupyterlab/vega5-extension": "~4.2.5",
152+
"@jupyterlab/workspaces": "~4.2.5",
153+
"@jupyterlab/workspaces-extension": "~4.2.5",
154+
"@lezer/common": "^1.0.0",
155+
"@lezer/highlight": "^1.0.0",
156+
"@lumino/algorithm": "^2.0.0",
157+
"@lumino/application": "^2.3.0-alpha.0",
158+
"@lumino/commands": "^2.0.1",
159+
"@lumino/coreutils": "^2.0.0",
160+
"@lumino/datagrid": "^2.3.0-alpha.0",
161+
"@lumino/disposable": "^2.0.0",
162+
"@lumino/domutils": "^2.0.0",
163+
"@lumino/dragdrop": "^2.0.0",
164+
"@lumino/keyboard": "^2.0.0",
165+
"@lumino/messaging": "^2.0.0",
166+
"@lumino/polling": "^2.0.0",
167+
"@lumino/properties": "^2.0.0",
168+
"@lumino/signaling": "^2.0.0",
169+
"@lumino/virtualdom": "^2.0.0",
170+
"@lumino/widgets": "^2.3.1-alpha.0",
171+
"@microsoft/fast-element": "^1.12.0",
172+
"@microsoft/fast-foundation": "^2.49.2",
173+
"react": "^18.2.0",
174+
"react-dom": "^18.2.0",
175+
"yjs": "^13.5.40"
48176
}
49177
}

packages/jupyterlab-preview/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
3939
"build:test": "tsc --build tsconfig.test.json",
4040
"clean": "jlpm run clean:lib && jlpm run clean:labextension",
41-
"clean:labextension": "rimraf ../../voila/labextension",
41+
"clean:labextension": "rimraf ../../voila/labextensions/jupyterlab-preview",
4242
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
4343
"test": "jest",
4444
"watch": "run-p watch:src watch:labextension",
@@ -75,7 +75,7 @@
7575
"jupyterlab": {
7676
"extension": true,
7777
"schemaDir": "schema",
78-
"outputDir": "../../voila/labextension",
78+
"outputDir": "../../voila/labextensions/jupyterlab-preview",
7979
"discovery": {
8080
"server": {
8181
"managers": [

packages/voila/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
},
1212
"browserslist": ">0.8%, not ie 11, not op_mini all, not dead",
1313
"dependencies": {
14-
"@jupyter-widgets/base": "^6.0.10",
15-
"@jupyter-widgets/jupyterlab-manager": "^5.0.13",
14+
"@voila-dashboards/widgets-manager8": "^0.5.7",
1615
"@jupyterlab/application": "^4.0.0",
1716
"@jupyterlab/apputils": "^4.0.0",
1817
"@jupyterlab/apputils-extension": "^4.0.0",
1918
"@jupyterlab/codemirror": "^4.0.3",
2019
"@jupyterlab/codemirror-extension": "^4.0.0",
20+
"@jupyterlab/console": "^4.2.5",
2121
"@jupyterlab/coreutils": "^6.0.0",
2222
"@jupyterlab/docregistry": "^4.0.0",
2323
"@jupyterlab/javascript-extension": "^4.0.0",
@@ -34,6 +34,7 @@
3434
"@jupyterlab/rendermime-extension": "^4.0.0",
3535
"@jupyterlab/services": "^7.0.0",
3636
"@jupyterlab/settingregistry": "^4.0.0",
37+
"@jupyterlab/statedb": "^4.2.5",
3738
"@jupyterlab/theme-dark-extension": "^4.0.2",
3839
"@jupyterlab/theme-light-extension": "^4.0.2",
3940
"@jupyterlab/translation": "^4.0.0",
@@ -47,6 +48,7 @@
4748
"@lumino/domutils": "^2.0.0",
4849
"@lumino/dragdrop": "^2.0.0",
4950
"@lumino/messaging": "^2.0.0",
51+
"@lumino/polling": "^2.1.3",
5052
"@lumino/properties": "^2.0.0",
5153
"@lumino/signaling": "^2.0.0",
5254
"@lumino/virtualdom": "^2.0.0",

packages/voila/src/app.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import { PageConfig } from '@jupyterlab/coreutils';
1010

1111
import { IRenderMime } from '@jupyterlab/rendermime';
1212

13-
import { VoilaWidgetManager } from './plugins/widget';
14-
1513
import { IShell, VoilaShell } from './shell';
1614

15+
// Only import the type, it is important to not import the library at runtime
16+
// to not pollute the shared packages with widgets related things
17+
import { type VoilaWidgetManager } from '@voila-dashboards/widgets-manager8/lib/manager';
18+
1719
const PACKAGE = require('../package.json');
1820

1921
/**

packages/voila/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export * from './tools';
1414
export * from './plugins/tree/browser';
1515
export * from './plugins/tree/listing';
1616
export * from './plugins/themes/thememanager';
17-
export * from './plugins/widget/renderedcells';
17+
export * from './plugins/outputs/renderedcells';

0 commit comments

Comments
 (0)