Skip to content

Commit fe685a8

Browse files
Build against JupyterLab 4 (#336)
* Build against JupyterLab 4 * Update Playwright Snapshots * Black notebooks --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b673fc9 commit fe685a8

File tree

58 files changed

+9068
-9520
lines changed

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

+9068
-9520
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,37 @@ jobs:
2626
- name: Checkout
2727
uses: actions/checkout@v2
2828

29-
- name: Setup conda
30-
uses: conda-incubator/setup-miniconda@v2
29+
- name: Install Conda environment with Micromamba
30+
uses: mamba-org/provision-with-micromamba@main
3131
with:
32-
activate-environment: ipycanvas-dev
32+
environment-name: ipycanvas-dev
3333
environment-file: dev-environment.yml
34-
python-version: ${{ matrix.python-version }}
35-
mamba-version: "*"
36-
auto-activate-base: false
3734
channels: conda-forge
35+
extra-specs: |
36+
python=${{ matrix.python-version }}
3837
3938
- name: Test PEP8
4039
run: |
4140
black --check ipycanvas
41+
black --check examples/*.ipynb
4242
blacken-docs docs/*.rst
4343
44-
- name: Test PEP8 on example notebooks
45-
run: jupytext examples/*.ipynb --check 'black --check {}'
46-
4744
build:
4845
runs-on: ubuntu-latest
4946
steps:
5047

5148
- name: Checkout
5249
uses: actions/checkout@v2
5350

54-
- name: Setup conda
55-
uses: conda-incubator/setup-miniconda@v2
51+
- name: Install Conda environment with Micromamba
52+
uses: mamba-org/provision-with-micromamba@main
5653
with:
57-
activate-environment: ipycanvas-dev
54+
environment-name: ipycanvas-dev
5855
environment-file: dev-environment.yml
59-
python-version: ${{ matrix.python-version }}
60-
mamba-version: "*"
61-
auto-activate-base: false
6256
channels: conda-forge
57+
extra-specs: |
58+
python=${{ matrix.python-version }}
59+
6360
6461
- name: Build packages
6562
run: |
@@ -91,15 +88,14 @@ jobs:
9188
- name: Checkout
9289
uses: actions/checkout@v2
9390

94-
- name: Setup conda
95-
uses: conda-incubator/setup-miniconda@v2
91+
- name: Install Conda environment with Micromamba
92+
uses: mamba-org/provision-with-micromamba@main
9693
with:
97-
activate-environment: ipycanvas-dev
94+
environment-name: ipycanvas-dev
9895
environment-file: dev-environment.yml
99-
python-version: ${{ matrix.python-version }}
100-
mamba-version: "*"
101-
auto-activate-base: false
10296
channels: conda-forge
97+
extra-specs: |
98+
python=${{ matrix.python-version }}
10399
104100
- uses: actions/download-artifact@v2
105101
with:
@@ -131,31 +127,35 @@ jobs:
131127
- name: Validate the labextension
132128
run: jupyter labextension list 2>&1 | grep ipycanvas
133129

134-
- name: Install Galata
135-
run: |
136-
yarn install
137-
yarn playwright install chromium
138-
working-directory: ui-tests
139-
140-
- name: Launch JupyterLab
141-
run: yarn run start:detached
130+
- name: Install dependencies
131+
shell: bash -l {0}
142132
working-directory: ui-tests
133+
env:
134+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
135+
run: jlpm install
143136

144-
- name: Wait for JupyterLab
145-
uses: ifaxity/wait-on-action@v1
137+
- name: Set up browser cache
138+
uses: actions/cache@v3
146139
with:
147-
resource: http-get://localhost:8888/api
148-
timeout: 20000
140+
path: |
141+
${{ github.workspace }}/pw-browsers
142+
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
143+
144+
- name: Install browser
145+
shell: bash -l {0}
146+
run: npx playwright install chromium
147+
working-directory: ui-tests
149148

150-
- name: Run UI Tests
151-
run: yarn run test
149+
- name: Execute integration tests
150+
shell: bash -l {0}
152151
working-directory: ui-tests
152+
run: npx playwright test
153153

154-
- name: Upload UI Test artifacts
154+
- name: Upload Playwright Test report
155155
if: always()
156-
uses: actions/upload-artifact@v2
156+
uses: actions/upload-artifact@v3
157157
with:
158-
name: ui-test-output
158+
name: ipycanvas-playwright-tests
159159
path: |
160-
ui-tests/playwright-report
161160
ui-tests/test-results
161+
ui-tests/playwright-report

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v2
1717

18-
- name: Setup conda
19-
uses: conda-incubator/setup-miniconda@v2
18+
- name: Install Conda environment with Micromamba
19+
uses: mamba-org/provision-with-micromamba@main
2020
with:
21-
activate-environment: ipycanvas-dev
21+
environment-name: ipycanvas-dev
2222
environment-file: dev-environment.yml
23-
python-version: ${{ matrix.python-version }}
24-
mamba-version: "*"
25-
auto-activate-base: false
2623
channels: conda-forge
24+
extra-specs: |
25+
python=${{ matrix.python-version }}
2726
2827
- name: Build package
29-
run: python setup.py sdist bdist_wheel
28+
run: python -m build
3029

3130
- name: Publish the Python package
3231
env:

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodeLinker: node-modules
2+
enableImmutableInstalls: false

dev-environment.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ channels:
44
dependencies:
55
- pip
66
- build
7-
- yarn
8-
- nodejs=16
7+
- yarn=3
98
- jupyter-packaging
10-
- jupyterlab=3
11-
- ipywidgets>=7.6,<8
9+
- notebook
10+
- jupyterlab=4
11+
- ipywidgets>=7.6,<9
1212
- setuptools
1313
- wheel
1414
- twine
1515
- jupytext
1616
- black
1717
- blacken-docs
18+
- tokenize-rt

examples/Interaction during animation.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"source": [
6161
"# Some useful functions that will be used in our animation loop:\n",
6262
"\n",
63+
"\n",
6364
"# Draw the particles to the canvas\n",
6465
"def draw_particles():\n",
6566
" with hold_canvas():\n",

examples/drag_and_drop_example.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
" self.y = y_in\n",
3131
"\n",
3232
" def draw(self):\n",
33-
"\n",
3433
" canvas.fill_style = \"#38a8a4\"\n",
3534
" canvas.fill_rect(\n",
3635
" self.x - (self.width * 0.5), self.y - (self.height), self.width, self.height\n",
@@ -56,7 +55,6 @@
5655
" and y_in > y_coord\n",
5756
" and y_in < (y_coord + self.height)\n",
5857
" ):\n",
59-
"\n",
6058
" self.set_selected(True)\n",
6159
" return True\n",
6260
" else:\n",

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
},
5353
"dependencies": {
5454
"@jupyter-widgets/base": "^2.0.1 || ^3 || ^4 || ^5 || ^6",
55+
"@lumino/application": "^1.6.0 || ^2",
56+
"@lumino/widgets": "^1.6.0 || ^2",
5557
"buffer": "^4.9.2",
5658
"lodash": ">=4.17.13",
5759
"roughjs": "^4.3.1"
5860
},
5961
"devDependencies": {
60-
"@jupyterlab/builder": "^3.0.0",
61-
"@lumino/application": "^1.6.0",
62-
"@lumino/widgets": "^1.6.0",
62+
"@jupyterlab/builder": "^4",
6363
"@types/node": "^10.11.6",
6464
"@types/webpack-env": "^1.13.6",
6565
"@typescript-eslint/eslint-plugin": "^4.8.1",
@@ -75,7 +75,7 @@
7575
"rimraf": "^2.6.2",
7676
"source-map-loader": "^0.2.4",
7777
"ts-loader": "^5.2.1",
78-
"typescript": "~3.8",
78+
"typescript": "^5",
7979
"webpack": "^5",
8080
"webpack-cli": "^4"
8181
},

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
requires = [
33
"hatchling",
4-
"jupyterlab==3.*",
4+
"jupyterlab==4.*",
55
]
66
build-backend = "hatchling.build"
77

src/widget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,7 @@ export class CanvasView extends DOMWidgetView {
14611461
return { x, y };
14621462
}
14631463

1464+
// @ts-ignore: 2611
14641465
get tagName(): string {
14651466
return 'canvas';
14661467
}

ui-tests/.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodeLinker: node-modules
2+
enableImmutableInstalls: false

0 commit comments

Comments
 (0)