Skip to content

Commit

Permalink
Merge pull request #7 from imjoy-team/jupyterlab-4
Browse files Browse the repository at this point in the history
Support Jupyterlab>4
  • Loading branch information
oeway authored Apr 5, 2024
2 parents 7056781 + 45dc884 commit 87b8b24
Show file tree
Hide file tree
Showing 36 changed files with 6,036 additions and 17,251 deletions.
8 changes: 4 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v4.2.4
_commit: v4.2.5
_src_path: https://github.com/jupyterlab/extension-template
author_email: [email protected]
author_name: Wei Ouyang
has_binder: true
has_binder: false
has_settings: false
kind: frontend
labextension_name: imjoy-jupyterlab-extension
project_short_description: Run ImJoy plugins in JupyterLab
python_name: imjoy_jupyterlab_extension
repository: https://github.com/imjoy-team/imjoy-jupyterlab-extension.git
test: false
repository: https://github.com/imjoy-team/imjoy-jupyterlab-extension
test: true

14 changes: 0 additions & 14 deletions .github/workflows/binder-on-pr.yml

This file was deleted.

71 changes: 68 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: '*'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -26,6 +30,11 @@ jobs:
jlpm
jlpm run lint:check
- name: Test the extension
run: |
set -eux
jlpm run test
- name: Build the extension
run: |
set -eux
Expand All @@ -41,13 +50,13 @@ jobs:
pip install build
python -m build
pip uninstall -y "imjoy_jupyterlab_extension" jupyterlab
pip uninstall -y "imjoy-jupyterlab-extension" jupyterlab
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/imjoy_jupyterlab_extension*
path: dist/imjoy-jupyterlab-extension*
if-no-files-found: error

test_isolated:
Expand All @@ -70,13 +79,69 @@ jobs:
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install "jupyterlab>=4.0.0,<5" imjoy_jupyterlab_extension*.whl
pip install "jupyterlab>=4.0.0,<5" imjoy-jupyterlab-extension*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "imjoy-jupyterlab-extension.*OK"
python -m jupyterlab.browser_check --no-browser-test
integration-tests:
name: Integration tests
needs: build
runs-on: ubuntu-latest

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers

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

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

- name: Download extension package
uses: actions/download-artifact@v3
with:
name: extension-artifacts

- name: Install the extension
run: |
set -eux
python -m pip install "jupyterlab>=4.0.0,<5" imjoy-jupyterlab-extension*.whl
- name: Install dependencies
working-directory: ui-tests
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install

- name: Set up browser cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}

- name: Install browser
run: jlpm playwright install chromium
working-directory: ui-tests

- name: Execute integration tests
working-directory: ui-tests
run: |
jlpm playwright test
- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v3
with:
name: imjoy-jupyterlab-extension-playwright-tests
path: |
ui-tests/test-results
ui-tests/playwright-report
check_links:
name: Check Links
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
pull_request:
branches: ["*"]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check_release:
runs-on: ubuntu-latest
Expand All @@ -22,5 +26,5 @@ jobs:
- name: Upload Distributions
uses: actions/upload-artifact@v3
with:
name: imjoy_jupyterlab_extension-releaser-dist-${{ github.run_number }}
name: imjoy-jupyterlab-extension-releaser-dist-${{ github.run_number }}
path: .jupyter_releaser_checkout/dist
5 changes: 5 additions & 0 deletions .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
post_version_spec:
description: "Post Version Specifier"
required: false
# silent:
# description: "Set a placeholder in the changelog and don't publish the release."
# required: false
# type: boolean
since:
description: "Use PRs with activity since this date or git reference"
required: false
Expand All @@ -33,6 +37,7 @@ jobs:
version_spec: ${{ github.event.inputs.version_spec }}
post_version_spec: ${{ github.event.inputs.post_version_spec }}
branch: ${{ github.event.inputs.branch }}
# silent: ${{ github.event.inputs.silent }}
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}

Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish to PyPI

on:
workflow_dispatch:
# Optional inputs, you can add more according to your needs
inputs:
# version:
# description: 'Version of the package to release'
# required: true
# default: '1.0.0'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

# Add steps for any necessary setup, like installing dependencies
- name: Build
run: |
python -m pip install --upgrade pip
python -m pip install -U twine
python -m pip install -U wheel
python3 -m pip install build==1.0.3 # pin build
rm -rf ./build
rm -rf ./dist/*
jlpm build
jupyter lab build --minimize=False
python3 -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Update Playwright Snapshots

on:
issue_comment:
types: [created, edited]

permissions:
contents: write
pull-requests: write

jobs:
update-snapshots:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'please update snapshots') }}
runs-on: ubuntu-latest

steps:
- name: React to the triggering comment
run: |
gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout the branch from the PR that triggered the job
run: gh pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

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

- name: Install extension
run: |
set -eux
jlpm
python -m pip install .
- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: ui-tests
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
*.ipynb
imjoy-jupyterlab-extension
.pypirc
*.bundle.*
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/

.ipynb_checkpoints
*.tsbuildinfo
imjoy_jupyterlab_extension/labextension
# Version file is handled by hatchling
imjoy_jupyterlab_extension/_version.py

# Integration tests
ui-tests/test-results/
ui-tests/playwright-report/

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

Expand Down
Binary file removed .jupyterlite.doit.db
Binary file not shown.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules
**/lib
**/package.json
!/package.json
imjoy_jupyterlab_extension
imjoy-jupyterlab-extension
19 changes: 10 additions & 9 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
BSD 3-Clause License

Copyright (c) 2020, Wei Ouyang All rights reserved.
Copyright (c) 2024, Wei Ouyang
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down
Loading

0 comments on commit 87b8b24

Please sign in to comment.