diff --git a/.eslintrc.js b/.eslintrc.js index d66148c..df50b4e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,7 @@ module.exports = { ], parser: '@typescript-eslint/parser', parserOptions: { - project: 'tsconfig.json', + project: 'tsconfig.eslint.json', sourceType: 'module' }, plugins: ['@typescript-eslint'], diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9ccdc80..eb43a81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,26 +9,28 @@ jobs: strategy: matrix: python-version: [3.9, "3.10", "3.11"] + fail-fast: false steps: - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - uses: actions/checkout@v4 - - name: Install node - uses: actions/setup-node@v4 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + # https://github.com/jupyterlab/maintainer-tools/blob/main/.github/actions/base-setup/action.yml with: - node-version: '18.x' + python_version: ${{ matrix.python-version }} + node_version: '18.x' - name: Install dependencies - run: python -m pip install -U jupyterlab~=3.0 - - name: Build the extension + run: python -m pip install -U jupyterlab~=4.0 + - name: jlpm config + run: jlpm config set -H enableImmutableInstalls false + - name: install ts modules + run: jlpm + - name: jlpm lint check + run: jlpm run eslint:check + - name: install python package + run: python -m pip install . + - name: check for widgyts in extensions run: | - jlpm - jlpm run eslint:check - python -m pip install yt - python -m pip install . - jupyter server extension list 2>&1 | grep -ie "widgyts.*OK" jupyter labextension list 2>&1 | grep -ie "@yt-project/yt-widgets.*OK" - python -m jupyterlab.browser_check + - name: run jupyterlab browser check + run: python -m jupyterlab.browser_check diff --git a/.gitignore b/.gitignore index 4c81b4f..787e0bb 100644 --- a/.gitignore +++ b/.gitignore @@ -116,5 +116,4 @@ dmypy.json # yarn build related .yarn/ -.yarnrc.yml yarn.lock diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/README.md b/README.md index 0275416..c87f4de 100644 --- a/README.md +++ b/README.md @@ -41,13 +41,13 @@ The following assumes you're using conda. If not, you'll need to install nodejs in your environemnt separately. ```bash -conda create -n widgyts-dev -c conda-forge nodejs python=3.10 jupyterlab=3 +conda create -n widgyts-dev -c conda-forge nodejs python=3.10 jupyterlab=4 conda activate widgyts-dev ``` Install the python. This will also build the TS package. ```bash -pip install -e "." +pip install -e . ``` When developing your extensions, you need to manually enable your extensions with the diff --git a/package.json b/package.json index 8052b47..b14271b 100644 --- a/package.json +++ b/package.json @@ -60,54 +60,45 @@ }, "dependencies": { "@data-exp-lab/yt-tools": "^0.4.1", - "@jupyter-widgets/base": "^1.1.10 || ^2 || ^3 || ^4", - "@jupyterlab/application": "^3.0.4", - "@jupyterlab/coreutils": "^5.0.2", - "@jupyterlab/mainmenu": "^3.0.3", - "@jupyterlab/services": "^6.0.3", + "@jupyter-widgets/base": "^1.1.10 || ^2 || ^3 || ^4 || ^5 || ^6", + "@jupyterlab/application": "^4.2.5", "@types/fscreen": "^1.0.1", "@types/node": "^10.11.6", "@types/three": "^0.141.0", "fscreen": "^1.2.0", - "ipycanvas": "^0.8.2", + "ipycanvas": "^0.13.3", "jupyter-threejs": "^2.3.0" }, "devDependencies": { - "@jupyterlab/builder": "^3.0.0", - "@phosphor/application": "^1.6.0", - "@phosphor/widgets": "^1.6.0", - "@types/expect.js": "^0.3.29", - "@types/mocha": "^5.2.5", - "@types/node": "^10.11.6", - "@types/webpack-env": "^1.13.6", - "@typescript-eslint/eslint-plugin": "^3.6.0", - "@typescript-eslint/parser": "^3.6.0", - "acorn": "^7.2.0", - "css-loader": "^3.2.0", - "eslint": "^7.4.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-prettier": "^3.1.4", - "expect.js": "^0.3.1", - "fs-extra": "^7.0.0", - "karma": "^3.1.0", - "karma-chrome-launcher": "^2.2.0", - "karma-firefox-launcher": "^1.1.0", - "karma-ie-launcher": "^1.0.0", - "karma-mocha": "^1.3.0", - "karma-mocha-reporter": "^2.2.5", - "karma-typescript": "^5.0.3", - "karma-typescript-es6-transform": "^5.0.3", - "mkdirp": "^0.5.1", - "mocha": "^5.2.0", - "npm-run-all": "^4.1.3", - "prettier": "^2.0.5", - "rimraf": "^2.6.2", - "source-map-loader": "^0.2.4", - "style-loader": "^1.0.0", - "ts-loader": "^5.2.1", - "typescript": "^4.1.3", - "webpack": "^4.20.2", - "webpack-cli": "^3.1.2" + "@jupyter-widgets/base-manager": "^1.0.7", + "@jupyterlab/builder": "^4.0.11", + "@lumino/application": "^2.3.0", + "@lumino/widgets": "^2.3.1", + "@types/webpack-env": "^1.18.4", + "@typescript-eslint/eslint-plugin": "^6.19.1", + "@typescript-eslint/parser": "^6.19.1", + "acorn": "^8.11.3", + "css-loader": "^6.9.1", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", + "fs-extra": "^11.2.0", + "identity-obj-proxy": "^3.0.0", + "mkdirp": "^3.0.1", + "npm-run-all": "^4.1.5", + "prettier": "^3.2.4", + "rimraf": "^5.0.5", + "source-map-loader": "^5.0.0", + "style-loader": "^3.3.4", + "ts-loader": "^9.5.1", + "typescript": "~5.3.3", + "webpack": "^5.90.0", + "webpack-cli": "^5.1.4" + }, + "devDependenciesComments": { + "@jupyterlab/builder": "pinned to the latest JupyterLab 4.x release", + "@lumino/application": "pinned to the latest Lumino 2.x release", + "@lumino/widgets": "pinned to the latest Lumino 2.x release" }, "sideEffects": [ "style/*.css", diff --git a/pyproject.toml b/pyproject.toml index da48193..129c652 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,8 @@ [build-system] requires = [ - "hatchling", - "jupyterlab~=3.1", + "hatchling>=1.21.1", + "jupyterlab>=4.0.0,<5", + "hatch-nodejs-version>=0.3.2", ] build-backend = "hatchling.build" @@ -16,7 +17,7 @@ authors = [ keywords = [ "Jupyter", "JupyterLab", - "JupyterLab3", + "JupyterLab4", ] classifiers = [ "Framework :: Jupyter", @@ -29,8 +30,8 @@ classifiers = [ ] dependencies = [ "ipycanvas>=0.4.7", - "ipywidgets>=7.5.1", - "jupyterlab~=3.0", + "ipywidgets>=8.0.0", + "jupyterlab>=4.0", "numpy>=1.14", "pythreejs>=2.2.0", "traitlets>=4.3.3", @@ -49,9 +50,13 @@ Tracker = "https://github.com/yt-project/widgyts/issues" [tool.hatch.build] artifacts = [ + "widgyts/labextension/*.tgz", "widgyts/labextension", ] +[tool.hatch.metadata] +allow-direct-references = true + [tool.hatch.build.targets.wheel.shared-data] "widgyts/labextension/static" = "share/jupyter/labextensions/@yt-project/yt-widgets/static" "install.json" = "share/jupyter/labextensions/@yt-project/yt-widgets/install.json" @@ -66,7 +71,7 @@ exclude = [ [tool.hatch.build.hooks.jupyter-builder] dependencies = [ - "hatch-jupyter-builder>=0.9.1", + "hatch-jupyter-builder>=0.8.3", ] build-function = "hatch_jupyter_builder.npm_builder" ensured-targets = [ @@ -77,7 +82,15 @@ skip-if-exists = [ "widgyts/labextension/static/style.js", ] +[tool.hatch.build.hooks.jupyter-builder.build-kwargs] +path = "." +build_cmd = "build:prod" +npm = [ + "jlpm", +] + [tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs] +path = "." build_dir = "widgyts/labextension" source_dir = "src" build_cmd = "install:extension" @@ -85,11 +98,7 @@ npm = [ "jlpm", ] -[tool.hatch.build.hooks.jupyter-builder.build-kwargs] -build_cmd = "build:prod" -npm = [ - "jlpm", -] + [tool.black] line-length = 88 diff --git a/src/fullscreen.ts b/src/fullscreen.ts index 2ef7b43..2a2ea9a 100644 --- a/src/fullscreen.ts +++ b/src/fullscreen.ts @@ -50,7 +50,7 @@ export class FullscreenButtonView extends DOMWidgetView { this.el.classList.add('jupyter-widgets'); this.el.classList.add('jupyter-button'); this.el.classList.add('widget-button'); - this.delegate('click', this.el, this._handle_click); + this.delegate('click', this.el.value, this._handle_click); this.update(); // Set defaults. } diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 0000000..0a76836 --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": [] +}