Skip to content

Commit 2be104a

Browse files
authored
Merge pull request #14 from datalayer/ft/add-lab-executor
Internalize frontend cell executor
2 parents 989d757 + b93cc84 commit 2be104a

Some content is hidden

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

44 files changed

+12404
-447
lines changed

.copier-answers.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: v4.3.0
3+
_src_path: https://github.com/jupyterlab/extension-template
4+
author_email: ''
5+
author_name: Datalayer
6+
has_binder: true
7+
has_settings: false
8+
kind: server
9+
labextension_name: jupyter-server-nbmodel
10+
project_short_description: A Jupyter Server extension to execute code cell from the
11+
server.
12+
python_name: jupyter_server_nbmodel
13+
repository: https://github.com/datalayer/jupyter-server-nbmodel
14+
test: true

.github/workflows/binder-on-pr.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
1-
# Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html
21
name: Binder Badge
32
on:
43
pull_request_target:
54
types: [opened]
65

7-
permissions:
8-
pull-requests: write
9-
10-
116
jobs:
127
binder:
138
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
1411
steps:
15-
- name: comment on PR with Binder link
16-
uses: actions/github-script@v7
12+
- uses: jupyterlab/maintainer-tools/.github/actions/binder-link@v1
1713
with:
18-
github-token: ${{secrets.GITHUB_TOKEN}}
19-
script: |
20-
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
21-
var PR_HEAD_REF = process.env.PR_HEAD_REF;
22-
github.issues.createComment({
23-
issue_number: context.issue.number,
24-
owner: context.repo.owner,
25-
repo: context.repo.repo,
26-
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
27-
})
28-
env:
29-
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
30-
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}
31-
14+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build.yml

Lines changed: 135 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -2,103 +2,161 @@ name: Build
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches:
6+
- main
67
pull_request:
7-
schedule:
8-
- cron: "0 0 * * *"
8+
branches:
9+
- '*'
910

10-
defaults:
11-
run:
12-
shell: bash -eux {0}
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
1314

1415
jobs:
1516
build:
1617
runs-on: ubuntu-latest
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
os: [ubuntu-latest, macos-latest, windows-latest]
21-
python-version: ["3.8", "3.12"]
2218

2319
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
20+
- name: Checkout
21+
uses: actions/checkout@v4
2622

27-
- name: Base Setup
28-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
23+
- name: Base Setup
24+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
2925

30-
- name: Install dependencies
31-
run: python -m pip install -U jupyter_server
26+
- name: Install dependencies
27+
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
3228

33-
- name: Build the extension
34-
run: |
35-
python -m pip install .
36-
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
29+
- name: Lint the extension
30+
run: |
31+
set -eux
32+
jlpm
33+
jlpm run lint:check
3734
38-
pip install build
39-
python -m build --sdist
40-
cp dist/*.tar.gz my_server_extension.tar.gz
41-
pip uninstall -y "jupyter_server_nbmodel" jupyter_server
42-
rm -rf "jupyter_server_nbmodel"
35+
- name: Test the extension
36+
run: |
37+
set -eux
38+
jlpm run test
4339
44-
- uses: actions/upload-artifact@v4
45-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
46-
with:
47-
name: my_server_extension-sdist
48-
path: my_server_extension.tar.gz
40+
- name: Build the extension
41+
run: |
42+
set -eux
43+
python -m pip install .[test]
4944
50-
check_links:
45+
pytest -vv -r ap --cov jupyter_server_nbmodel
46+
jupyter server extension list
47+
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
48+
49+
jupyter labextension list
50+
jupyter labextension list 2>&1 | grep -ie "jupyter-server-nbmodel.*OK"
51+
python -m jupyterlab.browser_check
52+
53+
- name: Package the extension
54+
run: |
55+
set -eux
56+
57+
pip install build
58+
python -m build
59+
pip uninstall -y "jupyter_server_nbmodel" jupyterlab
60+
61+
- name: Upload extension packages
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: extension-artifacts
65+
path: dist/jupyter_server_nbmodel*
66+
if-no-files-found: error
67+
68+
test_isolated:
69+
needs: build
5170
runs-on: ubuntu-latest
71+
5272
steps:
53-
- uses: actions/checkout@v4
54-
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
55-
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
73+
- name: Install Python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: '3.9'
77+
architecture: 'x64'
78+
- uses: actions/download-artifact@v4
79+
with:
80+
name: extension-artifacts
81+
- name: Install and Test
82+
run: |
83+
set -eux
84+
# Remove NodeJS, twice to take care of system and locally installed node versions.
85+
sudo rm -rf $(which node)
86+
sudo rm -rf $(which node)
87+
88+
pip install "jupyterlab>=4.0.0,<5" jupyter_server_nbmodel*.whl
89+
90+
91+
jupyter server extension list
92+
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
5693
57-
test_lint:
94+
jupyter labextension list
95+
jupyter labextension list 2>&1 | grep -ie "jupyter-server-nbmodel.*OK"
96+
python -m jupyterlab.browser_check --no-browser-test
97+
98+
integration-tests:
99+
name: Integration tests
100+
needs: build
58101
runs-on: ubuntu-latest
102+
103+
env:
104+
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers
105+
59106
steps:
60-
- uses: actions/checkout@v4
61-
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
62-
- name: Run Linters
63-
run: |
64-
bash ./.github/workflows/lint.sh
107+
- name: Checkout
108+
uses: actions/checkout@v4
109+
110+
- name: Base Setup
111+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
112+
113+
- name: Download extension package
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: extension-artifacts
117+
118+
- name: Install the extension
119+
run: |
120+
set -eux
121+
python -m pip install "jupyterlab>=4.0.0,<5" jupyter_server_nbmodel*.whl
122+
123+
- name: Install dependencies
124+
working-directory: ui-tests
125+
env:
126+
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
127+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
128+
run: jlpm install
129+
130+
- name: Set up browser cache
131+
uses: actions/cache@v4
132+
with:
133+
path: |
134+
${{ github.workspace }}/pw-browsers
135+
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
136+
137+
- name: Install browser
138+
run: jlpm playwright install chromium
139+
working-directory: ui-tests
140+
141+
- name: Execute integration tests
142+
working-directory: ui-tests
143+
run: |
144+
jlpm playwright test
65145
66-
check_release:
146+
- name: Upload Playwright Test report
147+
if: always()
148+
uses: actions/upload-artifact@v4
149+
with:
150+
name: jupyter_server_nbmodel-playwright-tests
151+
path: |
152+
ui-tests/test-results
153+
ui-tests/playwright-report
154+
155+
check_links:
156+
name: Check Links
67157
runs-on: ubuntu-latest
158+
timeout-minutes: 15
68159
steps:
69160
- uses: actions/checkout@v4
70-
- name: Base Setup
71-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
72-
- name: Install Dependencies
73-
run: |
74-
pip install -e .
75-
- name: Check Release
76-
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
77-
with:
78-
token: ${{ secrets.GITHUB_TOKEN }}
79-
- name: Upload Distributions
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: jupyter_server_nbmodel-releaser-dist-${{ github.run_number }}
83-
path: .jupyter_releaser_checkout/dist
84-
85-
test_sdist:
86-
needs: build
87-
runs-on: ubuntu-latest
88-
89-
steps:
90-
- name: Checkout
91-
uses: actions/checkout@v4
92-
- name: Install Python
93-
uses: actions/setup-python@v5
94-
with:
95-
python-version: "3.8"
96-
architecture: "x64"
97-
- uses: actions/download-artifact@v4
98-
with:
99-
name: my_server_extension-sdist
100-
- name: Install and Test
101-
run: |
102-
pip install my_server_extension.tar.gz
103-
pip install jupyter_server
104-
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
161+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
162+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

.github/workflows/check-release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches: ["main"]
5+
pull_request:
6+
branches: ["*"]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check_release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Base Setup
19+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
20+
- name: Check Release
21+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
22+
with:
23+
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Upload Distributions
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: jupyter_server_nbmodel-releaser-dist-${{ github.run_number }}
30+
path: .jupyter_releaser_checkout/dist

.github/workflows/enforce-label.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Enforce PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, edited, synchronize]
6+
jobs:
7+
enforce-label:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
steps:
12+
- name: enforce-triage-label
13+
uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1

.github/workflows/prep-release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Step 1: Prep Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version_spec:
6+
description: "New Version Specifier"
7+
default: "next"
8+
required: false
9+
branch:
10+
description: "The branch to target"
11+
required: false
12+
post_version_spec:
13+
description: "Post Version Specifier"
14+
required: false
15+
# silent:
16+
# description: "Set a placeholder in the changelog and don't publish the release."
17+
# required: false
18+
# type: boolean
19+
since:
20+
description: "Use PRs with activity since this date or git reference"
21+
required: false
22+
since_last_stable:
23+
description: "Use PRs with activity since the last stable git tag"
24+
required: false
25+
type: boolean
26+
jobs:
27+
prep_release:
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
steps:
32+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
33+
34+
- name: Prep Release
35+
id: prep-release
36+
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
version_spec: ${{ github.event.inputs.version_spec }}
40+
# silent: ${{ github.event.inputs.silent }}
41+
post_version_spec: ${{ github.event.inputs.post_version_spec }}
42+
branch: ${{ github.event.inputs.branch }}
43+
since: ${{ github.event.inputs.since }}
44+
since_last_stable: ${{ github.event.inputs.since_last_stable }}
45+
46+
- name: "** Next Step **"
47+
run: |
48+
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"

0 commit comments

Comments
 (0)