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

Update Jupyter extension #498

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
98 changes: 98 additions & 0 deletions .github/workflows/jupyter-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build Jupyter extension

on:
push:
branches: main
pull_request:
branches: '*'

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: webio_jupyter_extension

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

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

- name: Build WebIO (@webio/webio)
working-directory: .
run: |
set -eux
npm -C packages install --scripts-prepend-node-path=auto
npm -C packages run build-prod --scripts-prepend-node-path=auto

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

- name: Lint the extension
run: |
set -eux
jlpm
jlpm run eslint:check

- name: Build the extension
run: |
set -eux
python -m pip install .[test]

jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "webio_jupyter_extension.*OK"

jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK"
python -m jupyterlab.browser_check

- name: Package the extension
run: |
set -eux

pip install build
python -m build
pip uninstall -y "webio-jupyter-extension" jupyterlab

- name: Upload extension packages
uses: actions/upload-artifact@v4
with:
name: extension-artifacts
path: webio_jupyter_extension/dist/webio_jupyter_extension*
if-no-files-found: error

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v4
with:
name: extension-artifacts
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)

pip install "jupyterlab>=4.0.0,<5" webio_jupyter_extension*.whl


jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "webio_jupyter_extension.*OK"

jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK"
python -m jupyterlab.browser_check --no-browser-test

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dist
yarn.lock
node_modules
*.js.map
lerna-debug.log
*.log
package-lock.json
*.tgz
.yarn
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enableImmutableInstalls: false
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"workspaces": [
"./webio_jupyter_extension",
"./packages/*"
]
],
"packageManager": "[email protected]"
}
10 changes: 10 additions & 0 deletions src/providers/ijulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ function main()
@warn "IJulia doesn't have register_mime; WebIO may not work as expected. Please upgrade to IJulia v1.13.0 or greater."
end

# Delete any old comms before displaying the first WEBIO_NODE_MIME content (which prompts a new connection)
# Reason: If a freshly opened notebook has previously rendered WEBIO_NODE_MIME, an old comm is
# (incorrectly) registered from/by jupyter before WebIO has been init'ed
for (k,v) in IJulia.CommManager.comms
if IJulia.CommManager.comm_target(v) == :webio_comm
IJulia.CommManager.close_comm(v)
delete!(IJulia.CommManager.comms, k)
end
end

Comment on lines +81 to +87
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't actually work with Requires (not sure why), but it does work in my weakdeps branch at #516 .

# See comment on _IJuliaInit for what this does
display(_IJuliaInit())
end
Expand Down
96 changes: 0 additions & 96 deletions webio_jupyter_extension/.github/workflows/build.yml

This file was deleted.

25 changes: 13 additions & 12 deletions webio_jupyter_extension/.gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
*.bundle.*
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/
.ipynb_checkpoints
.ipynb_checkpoints/
.virtual_documents/
*.tsbuildinfo

# Ignore the built JS extension files
webio_jupyter_extension/labextension
webio_jupyter_extension/nbextension

# Ignore Yarn files (note: we're not using zero installs)
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
# Version file is handled by hatchling
webio_jupyter_extension/_version.py
_temp_extension

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down Expand Up @@ -68,6 +64,7 @@ htmlcov/
.coverage.*
.cache
nosetests.xml
coverage/
coverage.xml
*.cover
.hypothesis/
Expand All @@ -88,6 +85,7 @@ target/

# pyenv
.python-version
.venv/

# celery beat schedule file
celerybeat-schedule
Expand Down Expand Up @@ -122,3 +120,6 @@ dmypy.json

# OSX files
.DS_Store

# Yarn cache
.yarn/
631 changes: 0 additions & 631 deletions webio_jupyter_extension/.yarn/releases/yarn-berry.cjs

This file was deleted.

1 change: 0 additions & 1 deletion webio_jupyter_extension/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
yarnPath: ".yarn/releases/yarn-berry.cjs"
nodeLinker: node-modules
6 changes: 5 additions & 1 deletion webio_jupyter_extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Requirements

* JupyterLab >= 3.0
* JupyterLab >= 4.0

## Install

Expand Down Expand Up @@ -61,6 +61,10 @@ By default, the `yarn build` command generates the source maps for this extensio
jupyter lab build --minimize=False
```

### Debugging

Debug logging in the browser dev tools can be enabled by setting `localStorage.debug` to `"WebIO:*"` or `"WebIO:<component>"` where `<component>` is the part of WebIO you wish to get debug logging from.

### Development uninstall

```bash
Expand Down
48 changes: 25 additions & 23 deletions webio_jupyter_extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webio-jupyterlab-provider",
"version": "0.1.0",
"version": "0.2.0",
"description": "A JupyterLab extension.",
"keywords": [
"jupyter",
Expand All @@ -14,19 +14,21 @@
"main": "dist/labextension.js",
"repository": {
"type": "git",
"url": "https://github.com/github_username/webio-jupyterlab-provider.git"
"url": "https://github.com/JuliaGizmos/WebIO.jl.git",
"directory": "webio_jupyter_extension"
},
"scripts": {
"build": "yarn build:lib && yarn build:nbextension && yarn build:labextension:dev",
"build:prod": "yarn run clean && yarn run build:lib && yarn run build:labextension",
"build": "NODE_ENV=development npm-run-all build:lib:dev build:nbextension build:labextension:dev",
"build:prod": "NODE_ENV=production npm-run-all clean:all build:lib build:nbextension build:labextension",
"build:nbextension": "webpack -c webpack.nbextension.js",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc -p . && webpack -c webpack.labextension.js",
"clean": "yarn run clean:lib",
"clean:lib": "rimraf lib dist tsconfig.tsbuildinfo",
"clean:labextension": "rimraf webio_jupyter_extension/labextension",
"clean:all": "yarn run clean:lib && yarn run clean:labextension",
"clean:nbextension": "rimraf webio_jupyter_extension/nbextension",
"clean:all": "npm-run-all clean:lib clean:labextension clean:nbextension",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"install:extension": "yarn run build",
Expand All @@ -36,29 +38,29 @@
"publish-pypi": "yarn build && python3 -m build && python3 -m twine upload dist/*.whl dist/*.gz "
},
"dependencies": {
"@jupyterlab/application": "^3",
"@jupyterlab/docregistry": "^3",
"@jupyterlab/notebook": "^3",
"@jupyterlab/rendermime": "^3",
"@jupyterlab/services": "^6",
"@lumino/disposable": "^1",
"@lumino/widgets": "^1",
"@jupyterlab/application": "^4.0.6",
"@jupyterlab/docregistry": "^4.0.6",
"@jupyterlab/notebook": "^4.0.6",
"@jupyterlab/rendermime": "^4.0.6",
"@jupyterlab/services": "^7.0.6",
"@lumino/disposable": "^2.0.0",
"@lumino/widgets": "^2.0.1",
"@webio/webio": "portal:../packages/webio",
"debug": "^4.3.2"
},
"devDependencies": {
"@jupyterlab/builder": "^3.1.0",
"@jupyterlab/builder": "^4.0.0",
"@types/debug": "^4.1.7",
"@types/react": "^17.0.20",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"@types/react": "^18.0.26",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
"typescript": "~4.1.3",
"prettier": "^3.0.0",
"rimraf": "^5.0.1",
"typescript": "~5.0.2",
"webpack": "^5.52.0",
"webpack-cli": "^4.8.0"
},
Expand All @@ -69,7 +71,7 @@
"jupyter-releaser": {
"hooks": {
"before-build-npm": [
"python -m pip install jupyterlab~=3.1",
"python -m pip install jupyterlab~=4.0",
"yarn"
]
}
Expand Down
Loading
Loading