Skip to content

Commit

Permalink
Merge pull request #96 from martinRenou/jlab4_lumino2_widgets8
Browse files Browse the repository at this point in the history
JupyterLab 4 Lumino 2 and  ipywidgets 8 update
  • Loading branch information
ildipo authored Nov 29, 2023
2 parents 1224973 + 89957e6 commit 1d20c43
Show file tree
Hide file tree
Showing 36 changed files with 16,662 additions and 9,283 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ jobs:
restore-keys: |
${{ runner.os }}-conda-
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
activate-environment: beakerx_tabledisplay
environment-name: beakerx_tabledisplay
environment-file: configuration.yml
auto-activate-base: false
channels: conda-forge
miniconda-version: "latest"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -89,23 +87,22 @@ jobs:
- name: Install dependencies
run: |
set -eux
conda install jupyterlab=3 jupyter-packaging
pip install beakerx_tabledisplay
beakerx_tabledisplay install
- name: Install browser
working-directory: ui-tests
run: |
yarn install
jlpm install
# Install only Chromium browser
yarn playwright install chromium
jlpm playwright install chromium
- name: Execute benchmark tests on reference
continue-on-error: true
working-directory: ui-tests
run: |
yarn run test -u
jlpm run test -u
# Second run the benchmark on the new reference
- name: Checkout latest version
Expand All @@ -127,15 +124,15 @@ jobs:
- name: Install browser
working-directory: ui-tests
run: |
yarn install
jlpm install
# Install only Chromium browser
yarn playwright install chromium
jlpm playwright install chromium
- name: Execute benchmark tests on PR
continue-on-error: true
working-directory: ui-tests
run: |
yarn run test
jlpm run test
- name: Generate the report
env:
Expand Down
49 changes: 9 additions & 40 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Cache Conda
uses: actions/cache@v1
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
path: ~/.conda
key: ${{ runner.os }}-mconda-${{ hashFiles('**/configuration.yml') }}
restore-keys: |
${{ runner.os }}-conda-
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: beakerx_tabledisplay
environment-name: beakerx_tabledisplay
environment-file: configuration.yml
auto-activate-base: false
channels: conda-forge
miniconda-version: "latest"

- name: Verify conda version
shell: bash
run: conda --version

- name: Install build dependencies
run: conda install jupyterlab=3 jupyter-packaging

- name: Build BeakerX tabledisplay
run: (cd beakerx_tabledisplay; pip install -e .)
run: (cd beakerx_tabledisplay; pip install .)

- name: Check installation files (nbextension and lab3 extension)
run: |
Expand All @@ -53,11 +36,6 @@ jobs:
test -d $CONDA_PREFIX/share/jupyter/labextensions/@beakerx/beakerx-tabledisplay
test -f $CONDA_PREFIX/share/jupyter/labextensions/@beakerx/beakerx-tabledisplay/package.json
- name: Check nbextension and labextension (Lab3)
run: |
jupyter nbextension list 2>&1 | grep -ie "beakerx_tabledisplay/extension.*enabled" -
jupyter labextension list 2>&1 | grep -ie "@beakerx/beakerx-tabledisplay.*enabled.*ok" -
- name: Build wheel
run: |
cd beakerx_tabledisplay
Expand Down Expand Up @@ -99,37 +77,28 @@ jobs:
name: dist ${{ github.run_number }}
path: ./dist

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
activate-environment: beakerx_tabledisplay
environment-name: beakerx_tabledisplay
environment-file: configuration.yml
auto-activate-base: false
channels: conda-forge
miniconda-version: "latest"

- name: Install jupyterlab2
run: conda install jupyterlab=2

- name: Install the wheel
run: |
cd dist
pip install -vv beakerx_tabledisplay*.whl
- name: Manually install labextension for lab2
run: jupyter labextension install @jupyter-widgets/jupyterlab-manager beakerx_tabledisplay/js

- name: Check installation files (nbextension and lab3 extension)
- name: Check installation files (nbextension and lab extension)
run: |
test -d $CONDA_PREFIX/share/jupyter/nbextensions/beakerx_tabledisplay
test -f $CONDA_PREFIX/share/jupyter/nbextensions/beakerx_tabledisplay/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/beakerx_tabledisplay/index.js
test -d $CONDA_PREFIX/share/jupyter/labextensions/@beakerx/beakerx-tabledisplay
test -f $CONDA_PREFIX/share/jupyter/labextensions/@beakerx/beakerx-tabledisplay/package.json
- name: Check nbextension and labextension (Lab2)
- name: Check nbextension and labextension
run: |
jupyter nbextension list 2>&1 | grep -ie "beakerx_tabledisplay/extension.*enabled" -
jupyter labextension list 2>&1 | grep -ie "@beakerx/beakerx-tabledisplay.*enabled.*ok" -
- name: Run e2e tests (table v1)
Expand Down
1 change: 0 additions & 1 deletion beakerx_tabledisplay/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints

1 change: 0 additions & 1 deletion beakerx_tabledisplay/beakerx_tabledisplay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from ._version import version_info, __version__
from .commands import beakerx_parse
from .handlers import load_jupyter_server_extension
from .tabledisplay import *
from .tableitems import *
from .object import beakerx_tabledisplay
Expand Down
10 changes: 1 addition & 9 deletions beakerx_tabledisplay/beakerx_tabledisplay/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import sys

import beakerx_tabledisplay
from notebook import notebookapp as app

from .install import install, uninstall

Expand All @@ -39,16 +38,11 @@ def uninstall_subparser(subparser):
return subparser


def run_jupyter(jupyter_commands):
app.launch_new_instance(jupyter_commands)


def init_parser():
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--version',
action='version',
version=beakerx_tabledisplay.__version__)
parser.set_defaults(func=run_jupyter)

subparsers = parser.add_subparsers()
install_subparser(subparsers)
Expand All @@ -59,9 +53,7 @@ def init_parser():
def beakerx_parse():
parser = init_parser()
args, jupyter_commands = parser.parse_known_args()
if args.func == run_jupyter:
args.func(jupyter_commands)
elif not jupyter_commands:
if not jupyter_commands:
args.func(args)
else:
parser.parse_args(jupyter_commands)
37 changes: 0 additions & 37 deletions beakerx_tabledisplay/beakerx_tabledisplay/handlers.py

This file was deleted.

2 changes: 2 additions & 0 deletions beakerx_tabledisplay/js/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodeLinker: node-modules
enableImmutableInstalls: false
35 changes: 18 additions & 17 deletions beakerx_tabledisplay/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
"url": "https://github.com/twosigma/beakerx_tabledisplay.git"
},
"scripts": {
"build": "yarn run clean && yarn run build:css && yarn run build:js && webpack",
"build:labextension": "yarn run build && jupyter labextension build .",
"build:labextension:dev": "yarn run build && jupyter labextension build --development True .",
"build": "jlpm run clean && jlpm run build:css && jlpm run build:js && webpack && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:css": "sass sass/table_display.scss css/table_display.css",
"build:js": "tsc",
"watch:js": "tsc --watch",
"watch:webpack": "webpack --watch --progress",
"prepublish": "yarn run build",
"prepublish": "jlpm run build",
"test": "karma start --single-run",
"clean": "rimraf lib css dist ../beakerx_tabledisplay/labextension",
"lint": "eslint src/ --ext .ts",
Expand All @@ -36,8 +36,8 @@
"prettier:fix": "prettier --check src/**/*.{ts,js} --write"
},
"devDependencies": {
"@jupyterlab/builder": "^3.2.5",
"@jupyter-widgets/controls": "^3.0.0",
"@jupyter-widgets/controls": "^5",
"@jupyterlab/builder": "^4",
"@types/chai": "^4.2.11",
"@types/expect.js": "^0.3.29",
"@types/mocha": "^7.0.2",
Expand All @@ -63,30 +63,31 @@
"karma-webpack": "^4.0.2",
"mocha": "^7.1.2",
"prettier": "^2.0.5",
"rimraf": "^5.0.1",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"sinon": "^9.0.2",
"sinon-chai": "^3.5.0",
"style-loader": "^1.2.1",
"to-string-loader": "^1.1.6",
"ts-loader": "^7.0.4",
"typescript": "^3.8.3",
"typescript": "^5",
"url-loader": "^4.1.0",
"webpack": "^5",
"webpack-cli": "^4"
},
"dependencies": {
"@jupyterlab/application": "^3.2.5",
"@jupyter-widgets/base": "^4.0.0",
"@lumino/algorithm": "^1.3.3",
"@lumino/commands": "^1.11.3",
"@lumino/coreutils": "^1.5.3",
"@lumino/datagrid": "^0.18.0",
"@jupyter-widgets/base": "^4 || ^5 || ^6",
"@jupyterlab/application": "^4",
"@lumino/algorithm": "^2",
"@lumino/commands": "^2",
"@lumino/coreutils": "^2",
"@lumino/datagrid": "^2",
"@lumino/datastore": "^0.11.0",
"@lumino/disposable": "^1.4.3",
"@lumino/messaging": "^1.4.3",
"@lumino/signaling": "^1.4.3",
"@lumino/widgets": "^1.14.0",
"@lumino/disposable": "^2",
"@lumino/messaging": "^2",
"@lumino/signaling": "^2",
"@lumino/widgets": "^2",
"d3-scale": "2",
"file-loader": "^6.0.0",
"katex": "^0.11.1",
Expand Down
10 changes: 8 additions & 2 deletions beakerx_tabledisplay/js/src/dataGrid/BeakerXDataGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ declare global {
}

export class BeakerXDataGrid extends DataGrid {
id: string;
store: BeakerXDataStore;
dataModel: BeakerXDataGridModel;
highlighterManager: HighlighterManager;
columnManager: ColumnManager;
columnPosition: ColumnPosition;
Expand Down Expand Up @@ -115,6 +113,14 @@ export class BeakerXDataGrid extends DataGrid {
this.columnManager.createColumnMenus();
}

get dataModel(): BeakerXDataGridModel {
return super.dataModel as BeakerXDataGridModel;
}

set dataModel(value: BeakerXDataGridModel) {
super.dataModel = value;
}

scrollTo(x: number, y: number): void {
super.scrollTo(x, y);
if (this.tableDisplayView.canLoadMore() && this.maxScrollY <= y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { each, filter, iter, toArray } from '@lumino/algorithm';
import { each, filter, toArray } from '@lumino/algorithm';
import { CellRenderer } from '@lumino/datagrid';
import { Theme } from '../../utils/Theme';
import { BeakerXDataGrid } from '../BeakerXDataGrid';
Expand Down Expand Up @@ -95,7 +95,7 @@ export class HighlighterManager {

getColumnHighlighters(column, highlighterType?: HIGHLIGHTER_TYPE): Highlighter[] {
return toArray(
filter(iter(this.highlighters), (highlighter: Highlighter) => {
filter(this.highlighters, (highlighter: Highlighter) => {
return highlighterType
? highlighter.column === column && highlighter.state.type === highlighterType
: highlighter.column === column;
Expand Down Expand Up @@ -174,7 +174,7 @@ export class HighlighterManager {
let background = Theme.DEFAULT_COLOR;
const column = this.dataGrid.getColumn(config);

each(iter(this.highlighters), (highlighter) => {
each(this.highlighters, (highlighter: Highlighter) => {
if (highlighter.column === column || highlighter.state.style === HIGHLIGHTER_STYLE.FULL_ROW) {
background = highlighter.getBackgroundColor(config);
}
Expand Down
Loading

0 comments on commit 1d20c43

Please sign in to comment.