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

Add extension for Jupyter Notebook 7 #425

Merged
merged 28 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3f54ff7
start nb7 support
bollwyvl Sep 19, 2023
ae32a68
update test infrastructure
bollwyvl Sep 20, 2023
b7d3378
linting
bollwyvl Sep 20, 2023
7f5b351
more test work
bollwyvl Sep 20, 2023
4b8a889
fix artifact names
bollwyvl Sep 20, 2023
1842173
update with review comments
bollwyvl Sep 20, 2023
bc59fda
reduce more log noise
bollwyvl Sep 20, 2023
6219137
use session scope for utest performance, increase atest timeouts
bollwyvl Sep 20, 2023
6d13e74
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2023
a4887b4
emulate classic ui in notebook 7
bollwyvl Sep 20, 2023
64d4eec
fix notebook 7 test
bollwyvl Sep 20, 2023
cd3d900
update typescript comments, imports
bollwyvl Sep 21, 2023
af5bbb0
increase launcher wait time
bollwyvl Sep 21, 2023
c1fcdd0
ci: remove redundant shell specification
consideRatio Sep 21, 2023
6a1370b
ci: refactor without changing test matrix
consideRatio Sep 21, 2023
46ffda4
ci: check all server and frontent extension status
consideRatio Sep 21, 2023
70a6fbb
ci: let publish workflow use node v20 like in test workflow
consideRatio Sep 21, 2023
d1f2705
Remove no longer needed workaround for acceptance test dependencies
consideRatio Sep 21, 2023
f503dde
ci: reduce complexity of invoking pytest
consideRatio Sep 21, 2023
176c9f0
Revert "ci: reduce complexity of invoking pytest"
consideRatio Sep 21, 2023
5b13c20
ci: add pytest testpath config and comment about detail
consideRatio Sep 21, 2023
ca068b7
ci: upload codecov report
consideRatio Sep 21, 2023
da9c3ab
ci: fix broken assumption about pytest testpaths config
consideRatio Sep 21, 2023
4e73321
docs: update readme, jupyterlab 3 is now required
consideRatio Sep 21, 2023
754385d
ci: specify non-html codecov location
consideRatio Sep 21, 2023
8f0ff5e
address review comments
bollwyvl Sep 22, 2023
faf66f4
update with review comments
bollwyvl Sep 22, 2023
5dbcfa0
add windows to the matrix
bollwyvl Sep 22, 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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18.x
node-version: 20.x
registry-url: https://registry.npmjs.org
cache-dependency-path: labextension/yarn.lock

Expand Down
156 changes: 105 additions & 51 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
name: Test

Expand All @@ -23,109 +23,163 @@ on:
- "pre-commit-ci-update-config"
workflow_dispatch:

env:
# avoid warnings about config paths
JUPYTER_PLATFORM_DIRS: "1"

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 20.x
registry-url: https://registry.npmjs.org
cache-dependency-path: labextension/yarn.lock

- name: Update root build packages
run: pip install --upgrade build

- name: Build Python package
run: pyproject-build

- name: Upload built artifacts
uses: actions/upload-artifact@v3
with:
name: dist-${{ github.run_number }}
path: ./dist

test:
name: |-
${{ matrix.os }}
${{ matrix.python-version }}
s${{ matrix.jupyter_server-version }}
lab${{ matrix.jupyterlab-version }}
nb${{ matrix.notebook-version }}
needs: [build]
timeout-minutes: 30
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash # windows default isn't bash

strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version: ["3.8", "3.11"]
jupyter_server-version: ["1", "2"]
jupyterlab-version: ["3", "4"]
os: [ubuntu-22.04]
include:
- python-version: "3.11"
jupyter_server-version: "2"
# let jupyterlab-version 3 and 4 imply notebook-version 6 and 7
# respectively, to avoid doubling the amount of test runs
- jupyterlab-version: "3"
notebook-version: "6"
- jupyterlab-version: "4"
notebook-version: "7"
# windows should work for all test variations, but a limited selection
# is run to avoid doubling the amount of test runs
- os: windows-2022
python-version: "3.8"
jupyter_server-version: "1"
jupyterlab-version: "3"
os: windows-2022
- python-version: "3.11"
notebook-version: "6"
- os: windows-2022
python-version: "3.11"
jupyter_server-version: "2"
jupyterlab-version: "4"
os: windows-2022
notebook-version: "7"
exclude:
# jupyterlab-version 4 requires jupyter_server-version 2
- jupyter_server-version: "1"
jupyterlab-version: "4"

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"

- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18.x
registry-url: https://registry.npmjs.org
cache-dependency-path: labextension/yarn.lock

- name: Update root build packages
run: |
pip install --upgrade build pip
run: pip install --upgrade pip

- name: Build Python package
run: |
pyproject-build
- name: Download built artifacts
uses: actions/download-artifact@v3
with:
name: dist-${{ github.run_number }}
path: ./dist

- name: Install Python package
# NOTE: See CONTRIBUTING.md for a local development setup that differs
# slightly from this.
#
# Pytest options are set in `pyproject.toml`.
run: |
pip install -vv $(ls ./dist/jupyter_server_proxy-*.whl)\[acceptance\] 'jupyterlab~=${{ matrix.jupyterlab-version }}.0' 'jupyter_server~=${{ matrix.jupyter_server-version }}.0'
pip install -vv $(ls ./dist/*.whl)\[acceptance\] 'jupyterlab~=${{ matrix.jupyterlab-version }}.0' 'jupyter_server~=${{ matrix.jupyter_server-version }}.0' 'notebook~=${{ matrix.notebook-version }}.0'

- name: List Python packages
run: |
pip freeze
pip check

- name: Run tests
- name: Check server extension for jupyter_server
run: |
pytest -k "not acceptance" -vv

- name: Upload pytest and coverage reports
if: always()
uses: actions/upload-artifact@v3
with:
name: |-
unit-tests-${{ matrix.python-version }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
path: |
./build/pytest
./build/coverage
jupyter server extension list
jupyter server extension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -

- name: Check the Notebook Server extension is installed
- name: Check server extension for notebook v6
if: matrix.notebook-version == '6'
run: |
jupyter serverextension list
jupyter serverextension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -

- name: Check the Jupyter Server extension is installed
- name: Check frontend extension for notebook v6
if: matrix.notebook-version == '6'
run: |
pip install jupyter-server
jupyter server extension list
jupyter server extension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
jupyter nbextension list
PYTHONUNBUFFERED=1 jupyter nbextension list 2>&1 | grep -A1 -iE '.*jupyter_server_proxy.*enabled' | grep -B1 -iE "Validating.*OK"

- name: Check the lab extension
- name: Check frontend extension for notebook v7+
if: matrix.notebook-version != '6'
run: |
jupyter labextension list
jupyter labextension list 2>&1 | grep -iE '@jupyterhub/jupyter-server-proxy.*OK.*'
python -m jupyterlab.browser_check
jupyter notebook extension list
jupyter notebook extension list 2>&1 | grep -iE 'jupyter_server_proxy.*OK.*'

- name: Run acceptance tests
- name: Check frontend extension for jupyterlab
run: |
pytest -s -k "acceptance"
jupyter lab extension list
jupyter lab extension list 2>&1 | grep -iE 'jupyter_server_proxy.*OK.*'

- name: Upload acceptance test reports
- name: Run tests
run: |
# we have installed a pre-built wheel and configured code coverage to
# inspect "jupyter_server_proxy", by re-locating to another directory,
# there is no confusion about "jupyter_server_proxy" referring to our
# installed package rather than the local directory
mkdir build
cd build
pytest -c ../pyproject.toml ../tests

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v3
with:
name: |-
acceptance-tests-${{ matrix.python-version }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
tests-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
path: |
./build/pytest
./build/coverage
./build/robot

# GitHub action reference: https://github.com/codecov/codecov-action
- uses: codecov/codecov-action@v3
with:
directory: ./build/coverage
11 changes: 0 additions & 11 deletions labextension/.yarnrc

This file was deleted.

31 changes: 25 additions & 6 deletions labextension/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
# jlpm in JupyterLab 4 is yarn 3, and this is a yarn 2+ compatible configuration
# file.
#
# Config reference: https://yarnpkg.com/configuration/yarnrc
# jlpm in JupyterLab 4 is yarn 3
bollwyvl marked this conversation as resolved.
Show resolved Hide resolved
#
# JupyterLab 4 is used when building the extension as specified via
# ../pyproject.toml's build-system config, but the built extension can be used by
# JupyterLab 3 as well.

enableInlineBuilds: false
enableTelemetry: false
httpTimeout: 60000
nodeLinker: node-modules
httpTimeout: 300000
npmRegistryServer: "https://registry.npmjs.org/"
npmRegistryServer: https://registry.npmjs.org/
installStatePath: ./build/.cache/yarn/install-state.gz
cacheFolder: ./build/.cache/yarn/cache
# logFilters codes described: https://yarnpkg.com/advanced/error-codes
logFilters:
- code: YN0002 # MISSING_PEER_DEPENDENCY
level: discard
- code: YN0006 # SOFT_LINK_BUILD
level: discard
- code: YN0007 # MUST_BUILD
level: discard
- code: YN0008 # MUST_REBUILD
level: discard
- code: YN0013 # FETCH_NOT_CACHED
level: discard
- code: YN0019 # UNUSED_CACHE_ENTRY
level: discard
19 changes: 2 additions & 17 deletions labextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ configured server processes managed by the python package `jupyter-server-proxy`

## Prerequisites

- JupyterLab >=2,<5
- JupyterLab >=3,<5

## Installation

For JupyterLab 3+, use your preferred Python package manager to install `jupyter-server-proxy`:
Use your preferred Python package manager to install `jupyter-server-proxy`:

```bash
pip install jupyter-server-proxy
Expand All @@ -26,18 +26,3 @@ conda install jupyter-server-proxy
> As a _prebuilt_ extension, it will "just work," only a simple page reload should be required
> to see launcher items. However, a full restart of `jupyter_server` or `notebook` is required
> to reload the `jupyter_server_proxy` serverextension which provides most of the functionality.

### JupyterLab 2

For JupyterLab 2, ensure `nodejs` is installed and available on `$PATH` and run:

```bash
jupyter labextension install @jupyterhub/jupyter-server-proxy
```

> This will cause:
>
> - a download of a great deal of build assets from `npmjs.org`
> - a large `webpack` build that may exhaust memory and open files handles
>
> **Please** consider upgrading to JupyterLab 3+ before reporting issues.
17 changes: 10 additions & 7 deletions labextension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@
"watch": "run-p watch:src watch:labextension",
"watch:src": "jlpm build:lib -w --preserveWatchOutput",
"watch:labextension": "jupyter labextension watch .",
"deduplicate": "yarn-deduplicate -s fewer --fail"
"deduplicate": "yarn-deduplicate -s fewer --fail",
"lint:prettier": "prettier --write \"../.github/**/*.yaml\" \"../*.{yaml,yml,md}\" \"../docs/**/*.md\" \"src/**/*.{tsx,ts}\" \"./*.{yml,json,md}\""
},
"dependencies": {
"@jupyterlab/application": "^2.0 || ^3.0 || ^4.0",
"@jupyterlab/launcher": "^2.0 || ^3.0 || ^4.0"
"@jupyterlab/application": "^3.0 || ^4.0",
"@jupyterlab/filebrowser": "^3.0 || ^4.0",
consideRatio marked this conversation as resolved.
Show resolved Hide resolved
"@jupyterlab/launcher": "^3.0 || ^4.0"
},
"devDependencies": {
"@jupyterlab/builder": "^3.2.4 || ^4.0.0",
"@jupyterlab/builder": "^4.0.6",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"typescript": "~4.8.4",
"yarn-deduplicate": "^6.0.0"
"prettier": "^3.0.3",
"rimraf": "^5.0.1",
"typescript": "~5.2.2",
"yarn-berry-deduplicate": "^6.0.0"
},
"jupyterlab": {
"extension": true,
Expand Down
Loading