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 all 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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Your bug description here.
<!--
Please include the output of `Pkg.status("WebIO")` and `versioninfo()`, as well as what provider (i.e. IJulia/Jupyter, Blink, Mux, etc.) you are using.
If you are using Jupyter Notebook, please include the output of `jupyter nbextension list`.
If you are using Jupyter Lab, please include hte output of `jupyter labextension list`.
If you are using Jupyter Lab, please include hte output of `jupyter labextension list` and `jupyter server extension list`.
If relevant, please include any errors (from the Julia console, from the Jupyter process, or from your browser console) that you see.
-->
Your context here.
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
6 changes: 6 additions & 0 deletions docs/src/providers/ijulia.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jupyter nbextension list
jupyter labextension list
# Should include in output:
# webio-jupyterlab-provider vX.Y.Z enabled OK (python, webio_jupyter_extension)

jupyter server extension list
# Should include in output:
# webio_jupyter_extension.serverextension enabled
# - Validating webio_jupyter_extension.serverextension...
# webio_jupyter_extension.serverextension OK
```

If the installation is **NOT** installed, continue reading for troubleshooting steps.
Expand Down
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.

26 changes: 26 additions & 0 deletions webio_jupyter_extension/.github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check Release
on:
push:
branches: ["main"]
pull_request:
branches: ["*"]

jobs:
check_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:

token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Distributions
uses: actions/upload-artifact@v3
with:
name: webio-jupyter-extension-releaser-dist-${{ github.run_number }}
path: .jupyter_releaser_checkout/dist
41 changes: 41 additions & 0 deletions webio_jupyter_extension/.github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Step 1: Prep Release"
on:
workflow_dispatch:
inputs:
version_spec:
description: "New Version Specifier"
default: "next"
required: false
branch:
description: "The branch to target"
required: false
post_version_spec:
description: "Post Version Specifier"
required: false
since:
description: "Use PRs with activity since this date or git reference"
required: false
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
required: false
type: boolean
jobs:
prep_release:
runs-on: ubuntu-latest
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Prep Release
id: prep-release
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
version_spec: ${{ github.event.inputs.version_spec }}
post_version_spec: ${{ github.event.inputs.post_version_spec }}
branch: ${{ github.event.inputs.branch }}
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}

- name: "** Next Step **"
run: |
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"
57 changes: 57 additions & 0 deletions webio_jupyter_extension/.github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Step 2: Publish Release"
on:
workflow_dispatch:
inputs:
branch:
description: "The target branch"
required: false
release_url:
description: "The URL of the draft GitHub release"
required: false
steps_to_skip:
description: "Comma separated list of steps to skip"
required: false

jobs:
publish_release:
runs-on: ubuntu-latest
permissions:
# This is useful if you want to use PyPI trusted publisher
# and NPM provenance
id-token: write
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Populate Release
id: populate-release
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
branch: ${{ github.event.inputs.branch }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}

- name: Finalize Release
id: finalize-release
env:
# The following are needed if you use legacy PyPI set up
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# PYPI_TOKEN_MAP: ${{ secrets.PYPI_TOKEN_MAP }}
# TWINE_USERNAME: __token__
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
uses: jupyter-server/jupyter-releaser/.github/actions/finalize-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
release_url: ${{ steps.populate-release.outputs.release_url }}

- name: "** Next Step **"
if: ${{ success() }}
run: |
echo "Verify the final release"
echo ${{ steps.finalize-release.outputs.release_url }}

- name: "** Failure Message **"
if: ${{ failure() }}
run: |
echo "Failed to Publish the Draft Release Url:"
echo ${{ steps.populate-release.outputs.release_url }}
Loading
Loading