Skip to content

Commit

Permalink
Merge pull request #461 from ianhi/widgets8
Browse files Browse the repository at this point in the history
Starting testing latest ipywidgets + remove `<8` pin
  • Loading branch information
martinRenou committed Aug 22, 2022
2 parents b816e2a + af415fc commit eb3d3dc
Show file tree
Hide file tree
Showing 53 changed files with 4,522 additions and 6,377 deletions.
124 changes: 30 additions & 94 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,14 @@ on:
pull_request:
branches:
- main
schedule:
- cron: "0 12 * * 1" # monday at noon UTC

defaults:
run:
shell: bash -l {0}

jobs:
run:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.8]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ipympl-dev
environment-file: dev-environment.yml
python-version: ${{ matrix.python-version }}
mamba-version: "*"
auto-activate-base: false
channels: conda-forge

- name: Install ipympl
run: |
python -m build
pip install dist/*.whl
- name: Check installation files
run: |
test -d $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib/index.js
test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib
test -f $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib/package.json
- name: Check nbextension and labextension
run: |
jupyter nbextension list 2>&1 | grep -ie "jupyter-matplotlib/extension.*enabled" -
jupyter labextension list 2>&1 | grep -ie "jupyter-matplotlib.*enabled.*ok" -
- name: Run tests
run: pytest .

build:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -86,25 +44,23 @@ jobs:
name: dist ${{ github.run_number }}
path: ./dist

install:
Test:
runs-on: ${{ matrix.os }}-latest
needs: [build]

strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
python: ['3.6', '3.9']
python: ['3.10', '3.9']
mpl-version: ['3.5', 'latest']
include:
- python: '3.6'
- python: '3.10'
dist: 'ipympl*.tar.gz'
jlab_version: 3
- python: '3.9'
dist: 'ipympl*.whl'
jlab_version: 2.3.2

steps:

- name: Checkout
uses: actions/checkout@v2

Expand All @@ -117,7 +73,15 @@ jobs:
channels: conda-forge

- name: Install dependencies
run: mamba install python=${{ matrix.python-version }} pip yarn jupyterlab=${{ matrix.jlab_version }} ipywidgets jupyter-packaging
run: mamba install python=${{ matrix.python-version }} pip yarn nodejs=16 jupyterlab jupyter-packaging nbval pytest ipywidgets

- if: matrix.mpl-version == 'latest'
name: Install latest Matplotlib
run: pip install --upgrade --pre --index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple --extra-index-url https://pypi.org/simple matplotlib

- if: matrix.mpl-version != 'latest'
name: Install matplotlib pinned
run: mamba install matplotlib=${{ matrix.mpl-version}}.*

- uses: actions/download-artifact@v2
with:
Expand All @@ -129,12 +93,6 @@ jobs:
cd dist
pip install -vv ${{ matrix.dist }}
- name: Manually install labextension for lab2
if: ${{ matrix.jlab_version }} == 2.3.2
env:
NODE_OPTIONS: --openssl-legacy-provider
run: jupyter labextension install --debug .

- name: Test installation files
run: |
test -d $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib
Expand All @@ -150,60 +108,38 @@ jobs:
- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep jupyter-matplotlib

- name: Run pytest
run: pytest .

visual-regression-tests:
runs-on: ubuntu-latest
needs: [build]

strategy:
fail-fast: false

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
mamba-version: "*"
auto-activate-base: false
channels: conda-forge

- name: Install dependencies
run: mamba install pip yarn jupyterlab=3.0.11 ipywidgets jupyter-packaging

- uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist

- name: Install the package
run: pip install -vv ipympl*.whl
working-directory: dist

- name: Install test dependencies
run: yarn install
- name: Install Galata test dependencies
if: matrix.os == 'ubuntu'
run: |
yarn install
yarn playwright install chromium
working-directory: ui-tests

- name: Launch JupyterLab
run: yarn run start-jlab:detached
if: matrix.os == 'ubuntu'
run: yarn run start:detached
working-directory: ui-tests

- name: Wait for JupyterLab
if: matrix.os == 'ubuntu'
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://localhost:8888/api
timeout: 20000

- name: Run UI Tests
if: matrix.os == 'ubuntu'
run: yarn run test
working-directory: ui-tests

- name: Upload UI Test artifacts
if: always()
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@v2
with:
name: ui-test-output
path: ui-tests/test-output
path: |
ui-tests/playwright-report
ui-tests/test-results
59 changes: 0 additions & 59 deletions .github/workflows/mpl-latest.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ ipympl/nbextension/index.*
ipympl/nbextension/package.json
ipympl/labextension/*.tgz

ui-tests/test-output
ui-tests/test-results
ui-tests/playwright-report

# Coverage data
# -------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ipympl

[![Test Status](https://github.com/matplotlib/ipympl/actions/workflows/mpl-latest.yml/badge.svg)](https://github.com/matplotlib/ipympl/actions/workflows/mpl-latest.yml?query=branch%3Amaster)
[![Test Status](https://github.com/matplotlib/ipympl/actions/workflows/main.yml/badge.svg)](https://github.com/matplotlib/ipympl/actions/workflows/main.yml?query=branch%3Amain)
[![Latest PyPI version](https://img.shields.io/pypi/v/ipympl?logo=pypi)](https://pypi.python.org/pypi/ipympl)
[![Latest conda-forge version](https://img.shields.io/conda/vn/conda-forge/ipympl?logo=conda-forge)](https://anaconda.org/conda-forge/ipympl)
[![Latest npm version](https://img.shields.io/npm/v/jupyter-matplotlib?logo=npm)](https://www.npmjs.com/package/jupyter-matplotlib)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"webpack-cli": "^4.0.0"
},
"dependencies": {
"@jupyter-widgets/base": "^2 || ^3 || ^4.0.0",
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
"@types/node": "^14.14.35",
"lodash": "^4.17.21"
},
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
'ipython_genutils',
'pillow',
'traitlets<6',
'ipywidgets>=7.6.0,<8',
'ipywidgets>=7.6.0,<9',
'matplotlib>=3.4.0,<4',
],
extras_require={
Expand Down
2 changes: 1 addition & 1 deletion ui-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Finally, run the galata tests:
yarn run test
```

If bqplot visuals change, you can re-generate reference images by running:
If ipympl visuals change, you can re-generate reference images by running:
```bash
yarn run update-references
```
3 changes: 0 additions & 3 deletions ui-tests/galata-config.json

This file was deleted.

5 changes: 4 additions & 1 deletion ui-tests/jupyter_server_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from tempfile import mkdtemp

c.ServerApp.port = 8888 # noqa
c.ServerApp.token = "" # noqa
c.ServerApp.password = "" # noqa
c.ServerApp.disable_check_xsrf = True # noqa
c.ServerApp.open_browser = False # noqa
c.LabApp.open_browser = False # noqa
c.ServerApp.root_dir = mkdtemp(prefix='galata-test-') # noqa

c.LabApp.expose_app_in_browser = True # noqa
13 changes: 7 additions & 6 deletions ui-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
"description": "ipympl UI Tests",
"private": true,
"scripts": {
"start-jlab": "jupyter lab --config ./jupyter_server_config.py",
"start-jlab:detached": "yarn run start-jlab&",
"clean": "rimraf tests/notebooks/.ipynb_checkpoints && rimraf test-output",
"test": "yarn run clean && galata --image-match-threshold 0.33",
"update-references": "galata --update-references"
"start": "jupyter lab --config ./jupyter_server_config.py",
"start:detached": "yarn run start&",
"test": "playwright test",
"test:debug": "PWDEBUG=1 playwright test",
"test:report": "http-server ./playwright-report -a localhost -o",
"test:update": "playwright test --update-snapshots"
},
"author": "ipympl",
"license": "Apache-2.0",
"dependencies": {
"@jupyterlab/galata": "3.0.11-2",
"@jupyterlab/galata": "^4.3.5",
"klaw-sync": "^6.0.0",
"rimraf": "^3.0.2"
}
Expand Down
7 changes: 7 additions & 0 deletions ui-tests/playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const baseConfig = require('@jupyterlab/galata/lib/playwright-config');

module.exports = {
...baseConfig,
timeout: 600000,
retries: 1,
};
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit eb3d3dc

Please sign in to comment.