Skip to content

Commit a3bc13b

Browse files
authored
Merge pull request #3086 from jasongrout/port7
Port 7.x changes to master
2 parents 671fd0f + dbfdc4f commit a3bc13b

Some content is hidden

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

59 files changed

+4252
-2470
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.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

.github/workflows/tests.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
run: |
2323
sudo apt-get install -y pandoc
2424
python -m pip install --upgrade pip
25-
pip install file://$PWD#egg=ipywidgets
26-
pip install -r ./docs/requirements.txt
25+
python -m pip install file://$PWD#egg=ipywidgets
26+
python -m pip install -r ./docs/requirements.txt
2727
- name: Build docs
2828
run: |
2929
cd docs
@@ -34,13 +34,26 @@ jobs:
3434

3535
steps:
3636
- uses: actions/checkout@v2
37-
- name: Use Node.js 10.x
38-
uses: actions/setup-node@v1
37+
- name: Set up Python
38+
uses: actions/setup-python@v1
3939
with:
40-
node-version: 10.x
40+
python-version: 3.7
41+
- uses: actions/cache@v1
42+
with:
43+
path: ~/.cache/pip
44+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}-${{hashFiles('**/requirements.txt')}}
45+
restore-keys: |
46+
${{ runner.os }}-pip-
4147
- name: Install dependencies
4248
run: |
4349
sudo apt-get install -y firefox
50+
python -m pip install --upgrade pip
51+
python -m pip install jupyterlab~=3.0
52+
53+
- name: Use Node.js 12.x
54+
uses: actions/setup-node@v1
55+
with:
56+
node-version: 12.x
4457
- name: Get yarn cache
4558
id: yarn-cache
4659
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -50,6 +63,7 @@ jobs:
5063
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
5164
restore-keys: |
5265
${{ runner.os }}-yarn-
66+
5367
- name: yarn install, build, test
5468
run: |
5569
yarn install --frozen-lockfile

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ npm-debug.log
2424
!.vscode/extensions.json
2525

2626
widgetsnbextension/widgetsnbextension/static
27+
jupyterlab_widgets/jupyterlab_widgets/labextension/
2728

2829
index.built.js
2930
index.built.js.map

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

0 commit comments

Comments
 (0)