Skip to content

Commit

Permalink
Merge branch '7.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Feb 5, 2021
2 parents 60c88a5 + 5532c91 commit eadb5ef
Show file tree
Hide file tree
Showing 58 changed files with 1,066 additions and 11,238 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build jupyterlab_widgets

on:
push:
branches: master
pull_request:
branches: '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
architecture: 'x64'
- name: Cache pip on Linux
uses: actions/cache@v1
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn
uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
python -m pip install jupyterlab~=3.0
python -m pip install jupyter_packaging
- name: Build the extension
run: |
pip install .
jlpm install
jlpm run build
cd jupyterlab_widgets
pwd
pip install -e .
jupyter labextension develop . --overwrite
jupyter labextension list
python -m jupyterlab.browser_check
10 changes: 4 additions & 6 deletions dev-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ $? -ne 0 ]; then
exit 1
fi

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

if test "$skip_jupyter_lab" != yes; then
jupyter labextension link ./packages/base --no-build
jupyter labextension link ./packages/base-manager --no-build
jupyter labextension link ./packages/controls --no-build
jupyter labextension link ./packages/output --no-build
jupyter labextension install ./packages/jupyterlab-manager
pip install jupyter_packaging
pip install -ve ./jupyterlab_widgets
jupyter labextension develop ./jupyterlab_widgets --overwrite
fi
54 changes: 40 additions & 14 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

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).

## 7.6

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.

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.

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.

### Updates for Widget Maintainers

Custom widget maintainers will need to make two changes to update for JupyterLab 3:

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.
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.

```json
"jupyterlab": {
"sharedPackages": {
"@jupyter-widgets/base": {
"bundled": false,
"singleton": true
}
}
}
```

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.

## 7.5

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.
Expand All @@ -17,14 +45,15 @@ Changes include:

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.


## 7.4

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.

Changes include:

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

## 7.3
Expand Down Expand Up @@ -61,7 +90,6 @@ User-visible changes include:
- `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))
- 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))
- The Output widget now has a `.capture()` method, which returns a decorator to capture the output of a function.

```python
from ipywidgets import Output
out = Output()
Expand All @@ -70,9 +98,7 @@ User-visible changes include:
def f():
print('This output is captured')
```

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))

- The Output widget has much more comprehensive documentation in its own section. ([#2020](https://github.com/jupyter-widgets/ipywidgets/pull/2020))
- Installing `widgetsnbextension` now automatically enables the nbextension in Jupyter Notebook 5.3 or later. ([#1911](https://github.com/jupyter-widgets/ipywidgets/pull/1911))
- 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))
Expand Down Expand Up @@ -149,19 +175,19 @@ If you are developing a custom widget or widget manager, here are some major cha

Major user-visible changes in ipywidgets 6.0 include:

- Rendering of Jupyter interactive widgets in various web contexts
- Rendering of Jupyter interactive widgets in various web contexts

sphinx documentation: http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
nbviewer: http://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Widget%20List.ipynb
Static web pages: http://jupyter.org/widgets
sphinx documentation: http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
nbviewer: http://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Widget%20List.ipynb
Static web pages: http://jupyter.org/widgets

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

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

- 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`.
- 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`.

- 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`.
- 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`.

- Removal of the Proxy and PlaceProxy widgets.

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

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

- 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.
- 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.

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

- Numerous bug fixes.

_Note for custom widget authors:_

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:

```javascript
...
defaults: function() {
Expand All @@ -195,6 +220,7 @@ defaults: function() {
...
```


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.

## 5.x
Expand Down
17 changes: 16 additions & 1 deletion docs/source/dev_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ conda deactivate
conda remove --all -y -n releasewidgets
rm -rf ipywidgets
conda create -c conda-forge --override-channels -y -n releasewidgets notebook nodejs twine
conda create -c conda-forge --override-channels -y -n releasewidgets notebook nodejs yarn twine jupyterlab=3 jupyter-packaging
conda activate releasewidgets
git clone [email protected]:jupyter-widgets/ipywidgets.git
Expand Down Expand Up @@ -55,6 +55,20 @@ yarn run publish

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.

### jupyterlab_widgets

Go into the `jupyterlab_widgets` directory. Change `jupyterlab_widgets/_version.py` to reflect the new version number.
```
python setup.py sdist bdist_wheel
twine check dist/*
twine upload dist/*
```

Verify that the package is uploaded.
```
curl -s https://pypi.org/pypi/jupyterlab-widgets/json | jq -r '[.releases[][] | [.upload_time, .digests.sha256, .filename] | join(" ")] | sort '
```

### widgetsnbextension

Go into the `widgetsnbextension` directory. Change `widgetsnbextension/_version.py` to reflect the new version number.
Expand Down Expand Up @@ -103,6 +117,7 @@ Using the above script, you can do:
```
hashes dist/*
hashes widgetsnbextension/dist/*
hashes jupyterlab_widgets/dist/*
```

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).
Expand Down
2 changes: 1 addition & 1 deletion docs/source/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ The [jupyter_sphinx](https://jupyter-sphinx.readthedocs.io) extension
enables jupyter-specific features in sphinx. It can be installed with `pip` and
`conda`.

In the `conf.py` sphinx configuration file, add `jupyter_sphinx.execute`
In the `conf.py` sphinx configuration file, add `jupyter_sphinx`
to the list of enabled extensions.

Then use the `jupyter-execute` directive to embed the output of code execution
Expand Down
67 changes: 45 additions & 22 deletions docs/source/user_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,24 @@ Users can install the current version of **ipywidgets** with
[pip](https://pip.pypa.io/en/stable/) or
[conda](https://conda.readthedocs.io/en/latest/).

With pip
--------
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:

``` bash
pip install ipywidgets
```

or with conda, do:

``` bash
conda install -c conda-forge ipywidgets
```

Installing in classic Jupyter Notebook
--------------------------------------

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:

```bash
jupyter nbextension enable --py widgetsnbextension
```

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

With conda
----------

``` bash
conda install -c conda-forge ipywidgets
If your Jupyter Notebook and the IPython kernel are installed in different
environments (for example, separate environments are providing different
Python kernels), then the installation requires two steps:

1. Install the `widgetsnbextension` package in the environment
containing the Jupyter Notebook server.
2. Install `ipywidgets` in each kernel's environment that will use ipywidgets.

For example, if using conda environments, with Jupyter Notebook installed on the
`base` environment and the kernel installed in an environment called `py36`,
the commands are:

```bash
conda install -n base -c conda-forge widgetsnbextension
conda install -n py36 -c conda-forge ipywidgets
```

Installing **ipywidgets** with conda will also enable the extension for you.
Installing in JupyterLab 3.0
----------------------------

Installing with multiple environments
-------------------------------------
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.

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

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

For example, if using conda environments, with the notebook installed on the
For example, if using conda environments, with JupyterLab installed on the
`base` environment and the kernel installed in an environment called `py36`,
the commands are:

```bash
conda install -n base -c conda-forge widgetsnbextension
conda install -n base -c conda-forge jupyterlab_widgets
conda install -n py36 -c conda-forge ipywidgets

```

Installing the JupyterLab Extension
-----------------------------------

To install the JupyterLab extension you also need to run the command below in
Installing into JupyterLab 1 or 2
---------------------------------

To install the JupyterLab extension into JupyterLab 1 or 2, you also need to run the command below in
a terminal which requires that you have [nodejs](https://nodejs.org/en/)
installed.

Expand Down
Loading

0 comments on commit eadb5ef

Please sign in to comment.