Skip to content

Commit 26086ba

Browse files
committed
Add migration guide for 8.0
1 parent 949ccde commit 26086ba

File tree

1 file changed

+72
-4
lines changed

1 file changed

+72
-4
lines changed

docs/source/migration_guides.md

+72-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,74 @@ Migrating custom widget libraries
44
These are migration guides aimed specifically at developers of third-party
55
widgets.
66

7+
Migrating from 7.0 to 8.0
8+
-------------------------
9+
10+
For example migrations, see these PRs:
11+
12+
- [ipydatagrid](https://github.com/bloomberg/ipydatagrid/pull/282)
13+
14+
To avoid tying your development cycle to ipywidgets, we recommend starting
15+
the migration on a branch and keeping that branch open until ipywidgets 8.0
16+
is released.
17+
18+
We also recommend testing the migration in a completely new notebook, rather
19+
than one that contains widgets that you instantiated with ipywidgets 7.0.
20+
21+
### Updating setup.py
22+
23+
Start by updating the dependency in your `setup.py` to the latest release.
24+
25+
### Updating package.json
26+
27+
Next, we should update the JavaScript dependencies. You will need to update
28+
your `@jupyter-widgets/base` dependency and the `@jupyter-widgets/controls` **if**
29+
you depend on it.
30+
31+
The diff will look like the following in case you want to still support ipywidgets<8:
32+
33+
```diff
34+
- "@jupyter-widgets/base": "^2 || ^3 || ^4",
35+
+ "@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5",
36+
```
37+
38+
You can also apply the following diff if you only want to support ipywidgets==8 from now on:
39+
40+
```diff
41+
- "@jupyter-widgets/base": "^2 || ^3 || ^4",
42+
+ "@jupyter-widgets/base": "^5",
43+
```
44+
45+
### Updating the client-side code
46+
47+
You should only need to change your client-side JavaScript code if you have mentions to the
48+
archived Phosphor library.
49+
50+
The maintenance for the Phosphor library (now named Lumino) is done under the JupyterLab governance: https://github.com/jupyterlab/lumino
51+
52+
If you used to import classes like ``JupyterPhosphorPanelWidget`` and ``JupyterPhosphorWidget`` from the ``@jupyter-widgets/base`` library, you will need to update them:
53+
54+
```diff
55+
- import { JupyterPhosphorPanelWidget, JupyterPhosphorWidget } from '@jupyter-widgets/base';
56+
+ import { JupyterLuminoPanelWidget, JupyterLuminoWidget } from '@jupyter-widgets/base';
57+
```
58+
59+
The ``DOMWidgetView.pWidget`` property has been renamed ``DOMWidgetView.luminoWidget`` (though an alias for ``pWidget`` has been made for conveniance):
60+
61+
```diff
62+
- this.pWidget
63+
+ this.luminoWidget
64+
```
65+
66+
The ``DOMWidgetView.processPhosphorMessage`` method has been renamed ``DOMWidgetView.processLuminoMessage``:
67+
68+
```diff
69+
- processPhosphorMessage(msg: Message): void {
70+
- super.processPhosphorMessage(msg);
71+
+ processLuminoMessage(msg: Message): void {
72+
+ super.processLuminoMessage(msg);
73+
```
74+
775
Migrating from 6.0 to 7.0
876
-------------------------
977

@@ -14,7 +82,7 @@ For example migrations, see these PRs:
1482

1583
To avoid tying your development cycle to ipywidgets, we recommend starting
1684
the migration on a branch and keeping that branch open until ipywidgets 7.0
17-
is released.
85+
is released.
1886

1987
We also recommend testing the migration in a completely new notebook, rather
2088
than one that contains widgets that you instantiated with ipywidgets 6.0.
@@ -30,9 +98,9 @@ cycle through the tags until you see the latest 7.0.0 tag.
3098

3199
Next, we should update the JavaScript dependencies. The most important change
32100
for widget developers is that the JavaScript package for jupyter-widgets has
33-
been split between `@jupyter-widgets/base` and `@jupyter-widgets/controls`:
101+
been split between `@jupyter-widgets/base` and `@jupyter-widgets/controls`:
34102
- `@jupyter-widgets/base` contains the base widget classes and the layout
35-
classes
103+
classes
36104
- `@jupyter-widgets/controls` contains the widget classes for the
37105
user-facing widgets.
38106

@@ -105,7 +173,7 @@ that matches a release on NPM. The most common pattern is to request a
105173
version compatible with the version currently in your `package.json` by using,
106174
`~{{ version number }}` for `_model_module_version` and `_view_module_version`. See the [cookiecutter
107175
template](https://github.com/jupyter-widgets/widget-cookiecutter/blob/master/%7B%7Bcookiecutter.github_project_name%7D%7D/js/lib/example.js#L24)
108-
for details.
176+
for details.
109177

110178
Since you probably want to avoid repeating the module version in every
111179
widget, a common pattern is to import the version from `package.json` and

0 commit comments

Comments
 (0)