Skip to content

Commit eadb5ef

Browse files
committed
Merge branch '7.x'
2 parents 60c88a5 + 5532c91 commit eadb5ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1066
-11238
lines changed

.github/workflows/build.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build jupyterlab_widgets
2+
3+
on:
4+
push:
5+
branches: master
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v1
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '12.x'
19+
- name: Install Python
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: '3.8'
23+
architecture: 'x64'
24+
- name: Cache pip on Linux
25+
uses: actions/cache@v1
26+
if: startsWith(runner.os, 'Linux')
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ matrix.python }}-${{ hashFiles('**/requirements.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-${{ matrix.python }}
32+
33+
- name: Get yarn cache directory path
34+
id: yarn-cache-dir-path
35+
run: echo "::set-output name=dir::$(yarn cache dir)"
36+
- name: Cache yarn
37+
uses: actions/cache@v1
38+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
39+
with:
40+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
41+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-yarn-
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install jupyterlab~=3.0
47+
python -m pip install jupyter_packaging
48+
- name: Build the extension
49+
run: |
50+
pip install .
51+
jlpm install
52+
jlpm run build
53+
cd jupyterlab_widgets
54+
pwd
55+
pip install -e .
56+
jupyter labextension develop . --overwrite
57+
jupyter labextension list
58+
59+
python -m jupyterlab.browser_check

dev-install.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [ $? -ne 0 ]; then
2020
exit 1
2121
fi
2222

23-
echo -n "Checking jupyter lab... "
23+
echo -n "Checking JupyterLab (assuming JupyterLab >=3)... "
2424
jupyter lab --version 2>/dev/null
2525
if [ $? -ne 0 ]; then
2626
echo "no, skipping installation of widgets for jupyterlab"
@@ -52,9 +52,7 @@ echo -n "ipywidgets"
5252
pip install -v -e ".[test]"
5353

5454
if test "$skip_jupyter_lab" != yes; then
55-
jupyter labextension link ./packages/base --no-build
56-
jupyter labextension link ./packages/base-manager --no-build
57-
jupyter labextension link ./packages/controls --no-build
58-
jupyter labextension link ./packages/output --no-build
59-
jupyter labextension install ./packages/jupyterlab-manager
55+
pip install jupyter_packaging
56+
pip install -ve ./jupyterlab_widgets
57+
jupyter labextension develop ./jupyterlab_widgets --overwrite
6058
fi

docs/source/changelog.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
A summary of changes in ipywidgets. For more detailed information, see the issues and pull requests for the appropriate milestone on [GitHub](https://github.com/jupyter-widgets/ipywidgets).
44

5+
## 7.6
6+
7+
To see the full list of pull requests and issues, see the [7.6.0 milestone](https://github.com/jupyter-widgets/ipywidgets/milestone/31?closed=1) on GitHub.
8+
9+
The main change in this release is that installing `ipywidgets` 7.6.0 will now automatically enable ipywidgets support in JupyterLab 3.0—a user has no extra JupyterLab installation step and no rebuild of JupyterLab, nor do they need Node.js installed. Simply install the python ipywidgets package with pip (`pip install ipywidgets==7.6.0`) or conda/mamba (`conda install -c conda-forge ipywidgets=7.6.0`) and ipywidgets will automatically work in classic Jupyter Notebook and in JupyterLab 3.0.
10+
11+
This is accomplished with the new python package `jupyterlab_widgets` version 1.0, on which `ipywidgets` 7.6.0 now depends (similar to how `ipywidgets` already depends on the `widgetsnbextension` package to configure ipywidgets for the classic Jupyter Notebook). The `jupyterlab_widgets` Python package is a JupyterLab 3.0 prebuilt extension, meaning that it can be installed into JupyterLab 3.0 without rebuilding JupyterLab and without needing Node.js installed.
12+
13+
### Updates for Widget Maintainers
14+
15+
Custom widget maintainers will need to make two changes to update for JupyterLab 3:
16+
17+
1. Update the `@jupyter-widgets/base` dependency version to include `^4` to work in JupyterLab 3.0. For example, if you had a dependency on `@jupyter-widgets/base` version `^2 || ^3`, update to `^2 || ^3 || ^4` for your widget to work in classic Jupyter Notebook, JupyterLab 1, JupyterLab 2, and JupyterLab 3. See [#2472](https://github.com/jupyter-widgets/ipywidgets/pull/2472) for background.
18+
2. In the `package.json`, add the following `sharedPackages` configuration inside the `jupyterlab` key. See the [JupyterLab extension documentation](https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html#requiring-a-service) for more information.
19+
20+
```json
21+
"jupyterlab": {
22+
"sharedPackages": {
23+
"@jupyter-widgets/base": {
24+
"bundled": false,
25+
"singleton": true
26+
}
27+
}
28+
}
29+
```
30+
31+
Separate from these two steps to update for JupyterLab 3, we also recommend that you make your widget's JupyterLab extension a prebuilt extension for JupyterLab 3.0. Users will be able to install your JupyterLab 3.0 prebuilt extension without rebuilding JupyterLab or needing Node.js. See the [JupyterLab 3 extension developer documentation](https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html) or the new [widget extension cookiecutter](https://github.com/jupyter-widgets/widget-ts-cookiecutter/tree/jlab3) for more details.
32+
533
## 7.5
634

735
To see the full list of pull requests and issues, see the [7.5 milestone](https://github.com/jupyter-widgets/ipywidgets/milestone/268?closed=1) on GitHub.
@@ -17,14 +45,15 @@ Changes include:
1745

1846
Custom widget maintainers will need to update their `@jupyter-widgets/base` dependency version to work in JupyterLab 1.0. For example, if you had a dependency on `@jupyter-widgets/base` version `^1.1`, update to `^1.1 || ^2` for your widget to work in classic notebook, JupyterLab 0.35, and JupyterLab 1.0. See [#2472](https://github.com/jupyter-widgets/ipywidgets/pull/2472) for background.
1947

48+
2049
## 7.4
2150

2251
To see the full list of pull requests and issues, see the [7.4 milestone](https://github.com/jupyter-widgets/ipywidgets/milestone/26?closed=1) on GitHub.
2352

2453
Changes include:
2554

2655
- New `Video` and `Audio` widgets have been introduced. [#2162](https://github.com/jupyter-widgets/ipywidgets/pull/2162)
27-
We updated the `@jupyter-widgets/controls` widget specification version to `1.4.0`, leading to the version bump to 7.4.
56+
We updated the `@jupyter-widgets/controls` widget specification version to `1.4.0`, leading to the version bump to 7.4.
2857
- The use of mappings for the `options` attribute of selection widgets is deprecated. [#2130](https://github.com/jupyter-widgets/ipywidgets/pull/2130)
2958

3059
## 7.3
@@ -61,7 +90,6 @@ User-visible changes include:
6190
- `link` and `dlink` are now exported from ipywidgets for convenience, so that you can import them directly from ipywidgets instead of needing to import them from traitlets. ([#1923](https://github.com/jupyter-widgets/ipywidgets/pull/1923))
6291
- A new option `manual_name` has been added to `interact_manual()` to change the name of the update button, for example `interact_manual(manual_name='Update')`. ([#1924](https://github.com/jupyter-widgets/ipywidgets/pull/1923))
6392
- The Output widget now has a `.capture()` method, which returns a decorator to capture the output of a function.
64-
6593
```python
6694
from ipywidgets import Output
6795
out = Output()
@@ -70,9 +98,7 @@ User-visible changes include:
7098
def f():
7199
print('This output is captured')
72100
```
73-
74101
The `.capture()` method has a `clear_output` boolean argument to automatically clear the output every time the function is run, as well as a `wait` argument corresponding to the `clear_output` wait argument. ([#1934](https://github.com/jupyter-widgets/ipywidgets/pull/1934))
75-
76102
- The Output widget has much more comprehensive documentation in its own section. ([#2020](https://github.com/jupyter-widgets/ipywidgets/pull/2020))
77103
- Installing `widgetsnbextension` now automatically enables the nbextension in Jupyter Notebook 5.3 or later. ([#1911](https://github.com/jupyter-widgets/ipywidgets/pull/1911))
78104
- The default rendering of a widget if widgets are not installed is now a short description of the widget in text instead of a much longer HTML message. ([#2007](https://github.com/jupyter-widgets/ipywidgets/pull/2007))
@@ -149,19 +175,19 @@ If you are developing a custom widget or widget manager, here are some major cha
149175

150176
Major user-visible changes in ipywidgets 6.0 include:
151177

152-
- Rendering of Jupyter interactive widgets in various web contexts
178+
- Rendering of Jupyter interactive widgets in various web contexts
153179

154-
sphinx documentation: http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
155-
nbviewer: http://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Widget%20List.ipynb
156-
Static web pages: http://jupyter.org/widgets
180+
sphinx documentation: http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
181+
nbviewer: http://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Widget%20List.ipynb
182+
Static web pages: http://jupyter.org/widgets
157183

158184
- Addition of a DatePicker widget in the core widget collection.
159185

160-
- Changes to the automatic control generation syntax in @interact, inspired by the Sage interact syntax.
186+
- Changes to the automatic control generation syntax in @interact, inspired by the Sage interact syntax.
161187

162-
- Removal of APIs which had been deprecated in 5.0, including top-level styling in attributes of DOMWidgets and some corner cases in the behavior of `@interact`.
188+
- Removal of APIs which had been deprecated in 5.0, including top-level styling in attributes of DOMWidgets and some corner cases in the behavior of `@interact`.
163189

164-
- A new API for custom styling of widgets is provided, through a top-level `style` attribute. For example, the color of a slider handler can be set by `slider.style.handle_color`.
190+
- A new API for custom styling of widgets is provided, through a top-level `style` attribute. For example, the color of a slider handler can be set by `slider.style.handle_color`.
165191

166192
- Removal of the Proxy and PlaceProxy widgets.
167193

@@ -175,16 +201,15 @@ Major user-visible changes in ipywidgets 6.0 include:
175201

176202
- Removal of the `button_style` attribute of the Dropdown widget
177203

178-
- Addition of an OutputWidget for capturing output and rich display objects. @interact has changed to use an OutputWidget for function output instead of overwriting the output area of a cell.
204+
- Addition of an OutputWidget for capturing output and rich display objects. @interact has changed to use an OutputWidget for function output instead of overwriting the output area of a cell.
179205

180-
- The jupyter-js-widgets Javascript implementation now relies on the PhosphorJS framework for the management of rich layout and a better integration of JupyterLab.
206+
- The jupyter-js-widgets Javascript implementation now relies on the PhosphorJS framework for the management of rich layout and a better integration of JupyterLab.
181207

182208
- Numerous bug fixes.
183209

184210
_Note for custom widget authors:_
185211

186212
ipywidgets 6.0 breaks backward compatibility with respect to the handling of default values of the JavaScript side. Now, the default values for core widget models are specified with a `default()` method returning a dictionary instead of a `default` dictionary attribute. If you want your library to be backwards compatible with ipywidgets 5.x, you could use [\_.result](http://underscorejs.org/#result) like this:
187-
188213
```javascript
189214
...
190215
defaults: function() {
@@ -195,6 +220,7 @@ defaults: function() {
195220
...
196221
```
197222

223+
198224
This should not have an impact when using your custom widgets in the classic notebook, but will be really important when deploying your interactive widgets in web contexts.
199225

200226
## 5.x

docs/source/dev_release.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ conda deactivate
1010
conda remove --all -y -n releasewidgets
1111
rm -rf ipywidgets
1212
13-
conda create -c conda-forge --override-channels -y -n releasewidgets notebook nodejs twine
13+
conda create -c conda-forge --override-channels -y -n releasewidgets notebook nodejs yarn twine jupyterlab=3 jupyter-packaging
1414
conda activate releasewidgets
1515
1616
git clone [email protected]:jupyter-widgets/ipywidgets.git
@@ -55,6 +55,20 @@ yarn run publish
5555

5656
Lerna will prompt you for version numbers for each of the changed npm packages in the version step. Lerna will then change the versions appropriately (including the interdependency versions), commit, and tag. The `yarn run publish` step then publishes the public packages that were versioned to npm.
5757

58+
### jupyterlab_widgets
59+
60+
Go into the `jupyterlab_widgets` directory. Change `jupyterlab_widgets/_version.py` to reflect the new version number.
61+
```
62+
python setup.py sdist bdist_wheel
63+
twine check dist/*
64+
twine upload dist/*
65+
```
66+
67+
Verify that the package is uploaded.
68+
```
69+
curl -s https://pypi.org/pypi/jupyterlab-widgets/json | jq -r '[.releases[][] | [.upload_time, .digests.sha256, .filename] | join(" ")] | sort '
70+
```
71+
5872
### widgetsnbextension
5973

6074
Go into the `widgetsnbextension` directory. Change `widgetsnbextension/_version.py` to reflect the new version number.
@@ -103,6 +117,7 @@ Using the above script, you can do:
103117
```
104118
hashes dist/*
105119
hashes widgetsnbextension/dist/*
120+
hashes jupyterlab_widgets/dist/*
106121
```
107122

108123
Commit the changes you've made above, and include the uploaded files hashes in the commit message. Tag the release if ipywidgets was released. Push to origin master (and include the tag in the push).

docs/source/embedding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ The [jupyter_sphinx](https://jupyter-sphinx.readthedocs.io) extension
211211
enables jupyter-specific features in sphinx. It can be installed with `pip` and
212212
`conda`.
213213

214-
In the `conf.py` sphinx configuration file, add `jupyter_sphinx.execute`
214+
In the `conf.py` sphinx configuration file, add `jupyter_sphinx`
215215
to the list of enabled extensions.
216216

217217
Then use the `jupyter-execute` directive to embed the output of code execution

docs/source/user_install.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@ Users can install the current version of **ipywidgets** with
55
[pip](https://pip.pypa.io/en/stable/) or
66
[conda](https://conda.readthedocs.io/en/latest/).
77

8-
With pip
9-
--------
8+
In most cases, installing the Python `ipywidgets` package will also automatically configure classic Jupyter Notebook and JupyterLab 3.0 to display ipywidgets. With pip, do:
109

1110
``` bash
1211
pip install ipywidgets
12+
```
13+
14+
or with conda, do:
15+
16+
``` bash
17+
conda install -c conda-forge ipywidgets
18+
```
19+
20+
Installing in classic Jupyter Notebook
21+
--------------------------------------
22+
23+
Most of the time, installing `ipywidgets` automatically configures Jupyter Notebook to use widgets. The `ipywidgets` package does this by depending on the `widgetsnbextension` package, which configures the classic Jupyter Notebook to display and use widgets. If you have an old version of Jupyter Notebook installed, you may need to manually enable the ipywidgets notebook extension with:
24+
25+
```bash
1326
jupyter nbextension enable --py widgetsnbextension
1427
```
1528

@@ -18,41 +31,51 @@ an activated virtual environment, the ``--sys-prefix`` option may be required
1831
to enable the extension and keep the environment isolated (i.e.
1932
``jupyter nbextension enable --py widgetsnbextension --sys-prefix``).
2033

21-
With conda
22-
----------
2334

24-
``` bash
25-
conda install -c conda-forge ipywidgets
35+
If your Jupyter Notebook and the IPython kernel are installed in different
36+
environments (for example, separate environments are providing different
37+
Python kernels), then the installation requires two steps:
38+
39+
1. Install the `widgetsnbextension` package in the environment
40+
containing the Jupyter Notebook server.
41+
2. Install `ipywidgets` in each kernel's environment that will use ipywidgets.
42+
43+
For example, if using conda environments, with Jupyter Notebook installed on the
44+
`base` environment and the kernel installed in an environment called `py36`,
45+
the commands are:
46+
47+
```bash
48+
conda install -n base -c conda-forge widgetsnbextension
49+
conda install -n py36 -c conda-forge ipywidgets
2650
```
2751

28-
Installing **ipywidgets** with conda will also enable the extension for you.
52+
Installing in JupyterLab 3.0
53+
----------------------------
2954

30-
Installing with multiple environments
31-
-------------------------------------
55+
Most of the time, installing `ipywidgets` automatically configures JupyterLab 3.0 to use widgets. The `ipywidgets` package does this by depending on the `jupyterlab_widgets` package, version 1.0, which configures JupyterLab 3 to display and use widgets.
3256

33-
Sometimes the Jupyter Notebook and the IPython kernel are installed in different
34-
environments (either virtualenv or conda environments).
35-
This happens when environments are used to
36-
provide different IPython kernels. In this case, the installation requires two steps.
57+
If your JupyterLab and the IPython kernel are installed in different
58+
environments (for example, separate environments are providing different
59+
Python kernels), then the installation requires two steps:
3760

38-
First, you need to install the `widgetsnbextension` package in the environment
39-
containing the Jupyter Notebook server. Next, you need to install
40-
`ipywidgets` in each kernel's environment that will use ipywidgets.
61+
1. Install the `jupyterlab_widgets` package (version 1.0 or later) in the environment
62+
containing JupyterLab.
63+
2. Install `ipywidgets` in each kernel's environment that will use ipywidgets.
4164

42-
For example, if using conda environments, with the notebook installed on the
65+
For example, if using conda environments, with JupyterLab installed on the
4366
`base` environment and the kernel installed in an environment called `py36`,
4467
the commands are:
4568

4669
```bash
47-
conda install -n base -c conda-forge widgetsnbextension
70+
conda install -n base -c conda-forge jupyterlab_widgets
4871
conda install -n py36 -c conda-forge ipywidgets
49-
5072
```
5173

52-
Installing the JupyterLab Extension
53-
-----------------------------------
5474

55-
To install the JupyterLab extension you also need to run the command below in
75+
Installing into JupyterLab 1 or 2
76+
---------------------------------
77+
78+
To install the JupyterLab extension into JupyterLab 1 or 2, you also need to run the command below in
5679
a terminal which requires that you have [nodejs](https://nodejs.org/en/)
5780
installed.
5881

0 commit comments

Comments
 (0)