Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade nbdime for jupyterlab 4 #664

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
93383a7
Update dependencies for jupyterlab 4.
HaudinFlorence Apr 22, 2023
d33c94c
EditorWrapper migrated to CM6 and started mergeview
HaudinFlorence Apr 25, 2023
a1e3402
Update mergeview.ts and other files.
HaudinFlorence Jun 8, 2023
2c1a796
Update dependencies.
HaudinFlorence Jun 9, 2023
49873e7
Fixed build
JohanMabille Jun 9, 2023
66c64a5
Migrate highlighting to CM6.
HaudinFlorence Jun 14, 2023
9739058
Migrate padding to CM6.
HaudinFlorence Jul 3, 2023
8b0b49d
Keep on migrating padding (one effect by editor using decoration sets…
HaudinFlorence Jul 11, 2023
ad8495a
Migrate gutter markers.
HaudinFlorence Jul 13, 2023
405a535
Keep on migrating gutter markers
HaudinFlorence Jul 21, 2023
16a3fe5
Restore the missing syntax highlighting
HaudinFlorence Jul 31, 2023
22d9e3e
Update alignViews in mergeview.ts to correct padding issues (only the…
HaudinFlorence Aug 17, 2023
f5b0594
Fix spacers algorithm
fcollonval Aug 20, 2023
8a0cc2c
Fix last spacer
fcollonval Aug 21, 2023
eff078a
Merge pull request #1 from fcollonval/fix/alignement
HaudinFlorence Aug 22, 2023
6821c6d
Update alignViews in mergeview.ts to correct padding issues (only the…
HaudinFlorence Aug 17, 2023
76de3b4
Merge branch 'upgrate_nbdime_for_jupyterlab_4' of https://github.com/…
HaudinFlorence Aug 22, 2023
10fb172
Add first ui-tests
HaudinFlorence Aug 24, 2023
ee73abd
Update mergeview.ts to take review comments into account.
HaudinFlorence Aug 25, 2023
69ca95e
Update css files with minor changes.
HaudinFlorence Aug 25, 2023
f3689ad
Update to take review into account.
HaudinFlorence Aug 28, 2023
7b060a7
Keep on taking review into account regarding the iterator issue, depe…
HaudinFlorence Aug 30, 2023
055332d
Add jest types
jtpio Aug 30, 2023
119e45e
Try fix CI js failing tests and try to fix PatchObjectHelper iterator.
HaudinFlorence Aug 30, 2023
10b5a3a
Fix iterator implementation on `PatchObjectHelper`
krassowski Sep 1, 2023
a78edcd
Fix tests
krassowski Sep 1, 2023
6883a59
Fix Python test failing due to retained decorator
krassowski Sep 1, 2023
90218ff
Remove one more remnant of old mathjax
krassowski Sep 1, 2023
8835d16
Disable auto-detection of language servers to reduce startup time
krassowski Sep 1, 2023
ee8c3a8
Add ui-tests to github workflows.
HaudinFlorence Sep 1, 2023
a50750c
Add missing directory with example notebooks data/default/test2.
HaudinFlorence Sep 2, 2023
38fed9c
Try to make ui-tests work.
HaudinFlorence Sep 2, 2023
21f7229
Update ./github/workflows/tests.yml
HaudinFlorence Sep 2, 2023
ba72840
Update .github/workflows/tests.yml
HaudinFlorence Sep 2, 2023
1505ecb
Remove last commit change adding option --update-snapshots for npx pl…
HaudinFlorence Sep 2, 2023
b0e7fd3
Update .github/workflows/tests.yml
HaudinFlorence Sep 2, 2023
0001278
Update .github/workflows/update-integration-tests.yml
HaudinFlorence Sep 2, 2023
7647ee3
Take comments into account regarding test.yml file and tests.
HaudinFlorence Sep 2, 2023
73ac322
Apply suggestions from code review
HaudinFlorence Sep 3, 2023
4516871
Remove `set -eux` because it is Unix-only
krassowski Sep 3, 2023
4e7f0de
Use npm client
krassowski Sep 3, 2023
fb33501
Actually pass python version to setup script
krassowski Sep 3, 2023
a0e2893
Add missing `run`
krassowski Sep 3, 2023
31d933e
Add comment/reaction steps
krassowski Sep 3, 2023
c75e560
Add polyfill for playwright npx run
krassowski Sep 3, 2023
50fd2ab
Only update snapshots on latest Python, run one at a time
krassowski Sep 3, 2023
ecfc9d4
Update Playwright Snapshots
github-actions[bot] Sep 3, 2023
bbcedc3
Apply suggestions from code review
HaudinFlorence Sep 3, 2023
5e08176
Restore green colors backgrounds for the right editor for a diff.
HaudinFlorence Sep 4, 2023
43e6b01
Fix the added cells CSS style.
HaudinFlorence Sep 4, 2023
69d6d0d
Fix alignment shift for diff in alignViews.
HaudinFlorence Sep 5, 2023
fa30261
Fix `lineChunks` and editor configuration, including readOnly
krassowski Sep 6, 2023
0b43dbb
Remove hard-coded `lineNumbers` option
krassowski Sep 7, 2023
a24caec
Merge pull request #10 from krassowski/fix-1-and-2
HaudinFlorence Sep 7, 2023
0514335
Update mergeview.ts and diff.css to try to fix the added or deleted c…
HaudinFlorence Sep 7, 2023
e59d840
Take comment into account to fix the background of added/deleted cells.
HaudinFlorence Sep 7, 2023
b456cb9
Restore `getMergedValue()`
krassowski Sep 7, 2023
69c757d
Restore border indicator, remove unused .CodeMirror selector
krassowski Sep 7, 2023
84272ab
Merge pull request #11 from krassowski/final-fixes
HaudinFlorence Sep 7, 2023
22f9f70
Add ui-tests for diff and change ui-tests names and descriptions.
HaudinFlorence Sep 7, 2023
b887cef
Fix dep specification
fcollonval Sep 7, 2023
abaae02
Restore CSS scoping
fcollonval Sep 7, 2023
6e23fd0
Reduce diff due to format changes
fcollonval Sep 7, 2023
3ec3251
Restore `getMergedValue`
fcollonval Sep 7, 2023
ce62ca5
Improve integration tests
fcollonval Sep 7, 2023
89f35b9
Improve integration tests
fcollonval Sep 7, 2023
9768c1e
Avoid duplicating example/test contents
fcollonval Sep 7, 2023
4f6498b
Instantiate registries only once
fcollonval Sep 7, 2023
ba33eb5
Only create editor factory (and associated registries) once
fcollonval Sep 7, 2023
fd8c91f
Don't remove favicon when cleaning
fcollonval Sep 7, 2023
a35c7c0
Remove old typings
fcollonval Sep 7, 2023
8b42c16
Fix style not deduplicated
fcollonval Sep 7, 2023
e632709
Use only prebuilt extension
fcollonval Sep 7, 2023
274387b
Fix jobs config
fcollonval Sep 7, 2023
1e5ec7c
Fix jest tests
fcollonval Sep 7, 2023
314936e
Fix integration tests
fcollonval Sep 7, 2023
0149b17
Update symlink
fcollonval Sep 8, 2023
8250a96
Update Playwright Snapshots
github-actions[bot] Sep 8, 2023
19e7329
Update Playwright Snapshots
github-actions[bot] Sep 8, 2023
1a9d565
Update ui-tests/tests/nbdime-merge-test1.spec.ts
fcollonval Sep 8, 2023
e345cd7
Merge pull request #12 from fcollonval/small-things
HaudinFlorence Sep 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 103 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ name: Test
on: [push, pull_request]

jobs:

docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}-${{hashFiles('**/requirements.txt')}}
Expand All @@ -28,17 +29,18 @@ jobs:
run: |
cd docs
make html

js:
name: JavaScript
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}-${{hashFiles('**/requirements.txt')}}
Expand All @@ -47,18 +49,17 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install jupyterlab~=3.0
npm install -g codecov

- name: Use Node.js 18.x
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
Expand All @@ -71,33 +72,35 @@ jobs:
python -m pip install --upgrade --upgrade-strategy=eager -e ".[test]"
npm test
codecov
env:
CI: true

python:
name: Python
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest]
include:
- python-version: '3.11'
jupyter_server-version: '<2'
- python-version: '3.11'
jupyter_server-version: '>=2'
- python-version: '3.7'
- python-version: '3.8'
HaudinFlorence marked this conversation as resolved.
Show resolved Hide resolved
os: windows-latest
- python-version: '3.11'
os: windows-latest

outputs:
wheel: ${{ steps.packaging.outputs.wheel }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}-${{hashFiles('**/requirements.txt')}}
Expand Down Expand Up @@ -132,3 +135,88 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
directory: ${{ env.TEST_TMPDIR }}

- name: Build package
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == '3.10'
id: packaging
run: |
set -uex

pip install build
python -m build

WHEEL_NAME=$(ls dist/nbdime*.whl | cut -d '/' -f2)
echo "wheel=${WHEEL_NAME}" >> "$GITHUB_OUTPUT"

- name: Upload nbdime package
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == '3.10'
uses: actions/upload-artifact@v3
with:
name: nbdime-package
path: dist/nbdime*
if-no-files-found: error

ui-test:
needs: python
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-22.04]

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install Python '3.11'
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Download nbdime package
uses: actions/download-artifact@v3
with:
name: nbdime-package

- name: Install nbdime from wheel
run: |
python -m pip install "${{ needs.python.outputs.wheel }}"

- name: Install Playwright
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run:
npm install

- name: Set up browser cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/package-lock.json') }}

- name: Install browser
working-directory: ui-tests
run: npx playwright install chromium

- name: Run playwright tests
working-directory: ui-tests
run: |
npx playwright test

- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v3
with:
name: ui-tests-${{ matrix.os }}
path: |
ui-tests/playwright-report
70 changes: 70 additions & 0 deletions .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Update Playwright Snapshots

on:
issue_comment:
types: [created, edited]

permissions:
contents: write
pull-requests: write

jobs:
update-snapshots:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'please update playwright snapshots') }}
runs-on: ${{ matrix.os }}
concurrency: ci-${{ github.ref }}

strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-22.04]

steps:
- name: React to the triggering comment
run: |
hub api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure git to use https
run: git config --global hub.protocol https

- name: Checkout the branch from the PR that triggered the job
run: hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: '3.11'

- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"

- name: Install extension
run: |
python -m pip install .

- name: Build extension
run: |
npm run build

- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: ui-tests
npm_client: npm

- name: Comment back on the PR
run: |
hub api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments --raw-field 'body=Playwright ${{ matrix.os }} snapshots updated.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ nbdime/webapp/static/**
*.tsbuildinfo
packages/webapp/webpack-stats.json
nbdime/labextension/
ui-tests/playwright-report/
ui-tests/test-results/
1 change: 1 addition & 0 deletions examples/example1
56 changes: 56 additions & 0 deletions examples/example10/center.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "eabfe4e0-d646-4d09-95a4-09ee3d030db6",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"def gaussian(x, a, b, c):\n",
" #calculate a gaussian\n",
" return a * np.exp(-b * (x-c)**2)\n",
"\n",
"def sinus ():\n",
" # Here you can see a sinus function\n",
" nx = 100\n",
" x = np.linspace(-5.0, 5.0, nx)\n",
" y = np.sin(x)\n",
" return x, y\n",
"\n",
"def noisy_gaussian():\n",
" # gaussian array y in interval -5 <= x <= 5\n",
" nx = 100\n",
" x = np.linspace(-5.0, 5.0, nx)\n",
" y = gaussian(x, a=2.0, b=0.5, c=1.5)\n",
" noise = np.random.normal(0.0, 0.2, nx)\n",
" y += noise\n",
" return x, y"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
53 changes: 53 additions & 0 deletions examples/example10/left.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "2d47bfe2-d91d-4f72-9426-1885c4edb5a9",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%this is a comment\n",
"% more more comments\n",
"\n",
"def gaussian(x, a, b, c):\n",
" return a * np.exp(-b * (x-c)**2)\n",
" % here a comment\n",
" % second line of comment\n",
"\n",
"def noisy_gaussian():\n",
" # gaussian array y in interval -5 <= x <= 5\n",
" nx = 100\n",
" x = np.linspace(-5.0, 5.0, nx)\n",
" y = gaussian(x, a=2.0, b=0.5, c=1.5)\n",
" noise = np.random.normal(0.0, 0.2, nx)\n",
" y += noise\n",
" return x, y"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading