Skip to content

Commit

Permalink
Merge pull request #53 from miya-biz/lab4.x_squash
Browse files Browse the repository at this point in the history
migrate to JupyterLab 4.x, add ui-tests
  • Loading branch information
yacchin1205 authored Jan 4, 2024
2 parents 4a8ff53 + 3c91d15 commit fa957d5
Show file tree
Hide file tree
Showing 60 changed files with 15,070 additions and 6,918 deletions.
14 changes: 14 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v4.1.0
_src_path: https://github.com/jupyterlab/extension-template
author_email: [email protected]
author_name: ii masamitsu
has_binder: true
has_settings: true
kind: frontend
labextension_name: lc_multi_outputs
project_short_description: Multiple outputs as tabs
python_name: lc_multi_outputs
repository: https://github.com/entap/lc_multi_outputs.git
test: false

2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ dist
coverage
**/*.d.ts
tests

_temp_extension
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1 check-manifest
run: python -m pip install -U 'jupyterlab>=4.0.0,<5'

- name: Build the extension
run: |
Expand All @@ -29,8 +29,6 @@ jobs:
jupyter labextension list 2>&1 | grep -ie "lc_multi_outputs.*OK"
python -m jupyterlab.browser_check
check-manifest -v
pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
Expand All @@ -52,7 +50,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
python-version: 3.9
architecture: 'x64'
- name: Install node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: 18


- name: Get pip cache dir
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: 18
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'
architecture: 'x64'


- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
key: pip-3.9-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-3.9-
pip-
- name: Get yarn cache directory path
Expand All @@ -44,20 +44,23 @@ jobs:
yarn-
- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1 check-manifest
run: python -m pip install -U 'jupyterlab>=4.0.0,<5'
- name: Build the extension
run: |
set -eux
jlpm
jlpm run eslint:check
python -m pip install .
#jupyter server extension list 2>&1 | grep -ie "lc_multi_outputs.*OK"
#jupyter labextension list 2>&1 | grep -ie "lc_multi_outputs.*OK"
jupyter labextension list 2>&1 | grep -ie "lc_multi_outputs.*OK"
python -m jupyterlab.browser_check
check-manifest -v
jlpm install
cd ./ui-tests
jlpm install
jlpm playwright install
jlpm playwright test
cd ..
pip install build
python -m build --sdist
Expand Down
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
*.bundle.*
/lib/
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
lc_multi_outputs/labextension
# Version file is handled by hatchling
lc_multi_outputs/_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 All @@ -28,7 +35,7 @@ dist/
downloads/
eggs/
.eggs/
/lib
lib/
lib64/
parts/
sdist/
Expand Down Expand Up @@ -58,6 +65,7 @@ htmlcov/
.coverage.*
.cache
nosetests.xml
coverage/
coverage.xml
*.cover
.hypothesis/
Expand Down Expand Up @@ -112,3 +120,6 @@ dmypy.json

# OSX files
.DS_Store

# Yarn cache
.yarn/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
**/node_modules
**/lib
**/package.json
!/package.json
lc_multi_outputs
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enableImmutableInstalls: false

nodeLinker: node-modules
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM jupyter/scipy-notebook:latest

USER root

### extensions for jupyter
COPY . /tmp/multi_outputs
RUN pip --no-cache-dir install jupyter_nbextensions_configurator \
/tmp/multi_outputs

RUN jupyter labextension enable lc_multi_outputs

RUN jupyter nbclassic-extension install --py jupyter_nbextensions_configurator --sys-prefix && \
jupyter nbclassic-extension enable --py jupyter_nbextensions_configurator --sys-prefix && \
jupyter nbclassic-serverextension enable --py jupyter_nbextensions_configurator --sys-prefix && \
jupyter nbclassic-extension install --py lc_multi_outputs --sys-prefix && \
jupyter nbclassic-extension enable --py lc_multi_outputs --sys-prefix && \
fix-permissions /home/$NB_USER

USER $NB_USER
37 changes: 0 additions & 37 deletions MANIFEST.in

This file was deleted.

68 changes: 64 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ pip install git+https://github.com/NII-cloud-operation/Jupyter-multi_outputs
Copy the nbextension files into the jupyter server's search directory.

```
jupyter nbextension install --py lc_multi_outputs --user
jupyter nbclassic-extension install --py lc_multi_outputs --user
```

About details of `jupyter nbextension` subcommand, execute this command with `--help` option, and see the results.
About details of `jupyter nbclassic-extension` subcommand, execute this command with `--help` option, and see the results.

```
jupyter nbextension --help
jupyter nbclassic-extension --help
```

## Enabling extension

To use the multi_outputs extension, you will also need to enable it.

```
jupyter nbextension enable --py lc_multi_outputs --user
jupyter nbclassic-extension enable --py lc_multi_outputs --user
```

# Usage
Expand Down Expand Up @@ -122,6 +122,66 @@ This is an example of a code cell
}
```

## Uninstall

To remove the extension, execute:

```bash
pip uninstall lc_multi_outputs
```

## Contributing

### Development install

Note: You will need NodeJS to build the extension package.

The `jlpm` command is JupyterLab's pinned version of
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
`yarn` or `npm` in lieu of `jlpm` below.

```bash
# Clone the repo to your local environment
# Change directory to the lc_multi_outputs directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build
```

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
```

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

```bash
jupyter lab build --minimize=False
```

### Development uninstall

```bash
pip uninstall lc_multi_outputs
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `lc_multi_outputs` within that folder.

### Packaging the extension

See [RELEASE](RELEASE.md)

# License

This project is licensed under the terms of the Modified BSD License (also known as New or Revised or 3-Clause BSD), see LICENSE.txt.
Loading

0 comments on commit fa957d5

Please sign in to comment.