diff --git a/.github/workflows/check-tests.yml b/.github/workflows/check-tests.yml index 3384340..ef93ef8 100644 --- a/.github/workflows/check-tests.yml +++ b/.github/workflows/check-tests.yml @@ -19,7 +19,7 @@ jobs: uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Install dependencies - run: python -m pip install -U cookiecutter "jupyterlab>=4.0.0b0,<5" + run: python -m pip install -U cookiecutter "jupyterlab>=4.0.0,<5" - name: Create the extension run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0990453..9699b23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: # Trick to use custom parameters python -c "from cookiecutter.main import cookiecutter; import json, os; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']=d['kind'][0]; d['labextension_name']=os.getenv('NAME'); cookiecutter('.', extra_context=d, no_input=True)" pushd ${PYNAME} - python -m pip install "jupyterlab>=4.0.0b0,<5" + python -m pip install "jupyterlab>=4.0.0,<5" jlpm jlpm stylelint-config-prettier-check jlpm lint:check @@ -81,7 +81,7 @@ jobs: # Trick to use custom parameters python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']=d['kind'][0]; d['test']='n'; cookiecutter('.', extra_context=d, no_input=True)" pushd myextension - pip install "jupyterlab>=4.0.0b0,<5" + pip install "jupyterlab>=4.0.0,<5" jlpm jlpm lint:check pip install -e . @@ -120,7 +120,7 @@ jobs: # Trick to use custom parameters python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']=d['kind'][0]; d['has_settings']='y'; cookiecutter('.', extra_context=d, no_input=True)" pushd myextension - pip install "jupyterlab>=4.0.0b0,<5" + pip install "jupyterlab>=4.0.0,<5" jlpm # It is not easily possible to get this version compatible with linter rules jlpm lint @@ -164,7 +164,7 @@ jobs: cd myextension cat pyproject.toml pip install . - pip install "jupyterlab>=4.0.0b0,<5" + pip install "jupyterlab>=4.0.0,<5" jlpm jlpm lint:check @@ -189,7 +189,7 @@ jobs: python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']='server'; cookiecutter('.', extra_context=d, no_input=True)" cd myextension python -m pip install -e .[test] - python -m pip install "jupyterlab>=4.0.0b0,<5" + python -m pip install "jupyterlab>=4.0.0,<5" jupyter labextension develop . --overwrite jupyter server extension enable myextension @@ -223,7 +223,7 @@ jobs: # Trick to use custom parameters python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']='server'; cookiecutter('.', extra_context=d, no_input=True)" cd myextension - python -m pip install "jupyterlab>=4.0.0b0,<5" + python -m pip install "jupyterlab>=4.0.0,<5" jupyter lab clean --all python -m build cd dist @@ -289,7 +289,7 @@ jobs: sudo rm -rf $(which node) python -m pip install myextension.tar.gz - python -m pip install "jupyterlab>=4.0.0b0,<5" + python -m pip install "jupyterlab>=4.0.0,<5" jupyter labextension list 2>&1 | grep -ie "myextension.*OK" jupyter server extension list jupyter server extension list 2>&1 | grep -ie "myextension.*OK" @@ -319,7 +319,7 @@ jobs: # Trick to use custom parameters python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']='theme'; cookiecutter('.', extra_context=d, no_input=True)" pushd mytheme - python -m pip install "jupyterlab>=4.0.0b0,<5" + python -m pip install "jupyterlab>=4.0.0,<5" jlpm jlpm lint:check python -m pip install -e . @@ -360,7 +360,7 @@ jobs: python -c "from cookiecutter.main import cookiecutter; import json, os; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']=os.getenv('KIND'); d['labextension_name']='myextension'; cookiecutter('.', extra_context=d, no_input=True)" pushd myextension sed -i 's/^\(nodeLinker:\s\).*$/\1pnpm/' .yarnrc.yml - python -m pip install "jupyterlab>=4.0.0b0,<5" + python -m pip install "jupyterlab>=4.0.0,<5" jlpm if [ ! -d node_modules/.store ] ; then echo 'nodes_module directory should contain a .store directory when using pnpm nodeLinker'; exit 1; fi; jlpm build diff --git a/README.md b/README.md index ca65176..3984806 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Github Actions Status](https://github.com/jupyterlab/extension-cookiecutter-ts/workflows/CI/badge.svg)](https://github.com/jupyterlab/extension-cookiecutter-ts/actions/workflows/main.yml) +⚠️ **We strongly advice to use the template next generation: https://github.com/jupyterlab/extension-template** + A [cookiecutter](https://github.com/audreyr/cookiecutter) template for creating a JupyterLab extension. Three kinds of extension are supported: - _frontend_: Pure frontend extension written in TypeScript. diff --git a/{{cookiecutter.python_name}}/.github/workflows/build.yml b/{{cookiecutter.python_name}}/.github/workflows/build.yml index 80f85b4..a1c366b 100644 --- a/{{cookiecutter.python_name}}/.github/workflows/build.yml +++ b/{{cookiecutter.python_name}}/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Install dependencies - run: python -m pip install -U "jupyterlab>=4.0.0b0,<5" + run: python -m pip install -U "jupyterlab>=4.0.0,<5" - name: Lint the extension run: | @@ -81,7 +81,7 @@ jobs: sudo rm -rf $(which node) sudo rm -rf $(which node) - pip install "jupyterlab>=4.0.0b0,<5" {{ cookiecutter.python_name }}*.whl + pip install "jupyterlab>=4.0.0,<5" {{ cookiecutter.python_name }}*.whl {% if cookiecutter.kind.lower() == 'server' %} jupyter server extension list @@ -114,7 +114,7 @@ jobs: - name: Install the extension run: | set -eux - python -m pip install "jupyterlab>=4.0.0b0,<5" {{ cookiecutter.python_name }}*.whl + python -m pip install "jupyterlab>=4.0.0,<5" {{ cookiecutter.python_name }}*.whl - name: Install dependencies working-directory: ui-tests diff --git a/{{cookiecutter.python_name}}/.github/workflows/update-integration-tests.yml b/{{cookiecutter.python_name}}/.github/workflows/update-integration-tests.yml index ba5ea22..23f6e56 100644 --- a/{{cookiecutter.python_name}}/.github/workflows/update-integration-tests.yml +++ b/{{cookiecutter.python_name}}/.github/workflows/update-integration-tests.yml @@ -31,7 +31,7 @@ jobs:{# Escape double curly brace #}{% raw %} uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Install dependencies - run: python -m pip install -U "jupyterlab>=4.0.0b0,<5" + run: python -m pip install -U "jupyterlab>=4.0.0,<5" - name: Install extension run: | diff --git a/{{cookiecutter.python_name}}/README.md b/{{cookiecutter.python_name}}/README.md index 060db35..4ca6c10 100644 --- a/{{cookiecutter.python_name}}/README.md +++ b/{{cookiecutter.python_name}}/README.md @@ -13,7 +13,7 @@ for the frontend extension. {% endif %} ## Requirements -- JupyterLab >= 4.0.0b0 +- JupyterLab >= 4.0.0 ## Install diff --git a/{{cookiecutter.python_name}}/RELEASE.md b/{{cookiecutter.python_name}}/RELEASE.md index 868956c..5a52281 100644 --- a/{{cookiecutter.python_name}}/RELEASE.md +++ b/{{cookiecutter.python_name}}/RELEASE.md @@ -21,6 +21,18 @@ See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs- hatch version ``` +Make sure to clean up all the development files before building the package: + +```bash +jlpm clean:all +``` + +You could also clean up the local git repository: + +```bash +git clean -dfX +``` + To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do: ```bash diff --git a/{{cookiecutter.python_name}}/binder/environment.yml b/{{cookiecutter.python_name}}/binder/environment.yml index 04fc547..435eb1f 100644 --- a/{{cookiecutter.python_name}}/binder/environment.yml +++ b/{{cookiecutter.python_name}}/binder/environment.yml @@ -12,7 +12,7 @@ channels: dependencies: # runtime dependencies - python >=3.10,<3.11.0a0 - - jupyterlab >=4.0.0b0,<5 + - jupyterlab >=4.0.0,<5 # labextension build dependencies - nodejs >=18,<19 - pip diff --git a/{{cookiecutter.python_name}}/jest.config.js b/{{cookiecutter.python_name}}/jest.config.js index 3899384..b0471e6 100644 --- a/{{cookiecutter.python_name}}/jest.config.js +++ b/{{cookiecutter.python_name}}/jest.config.js @@ -1,6 +1,16 @@ const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config'); -const esModules = ['@jupyterlab/'].join('|'); +const esModules = [ + '@codemirror', + '@jupyter/ydoc', + '@jupyterlab/', + 'lib0', + 'nanoid', + 'vscode-ws-jsonrpc', + 'y-protocols', + 'y-websocket', + 'yjs' +].join('|'); const baseConfig = jestJupyterLab(__dirname); @@ -14,8 +24,5 @@ module.exports = { ], coverageReporters: ['lcov', 'text'], testRegex: 'src/.*/.*.spec.ts[x]?$', - transformIgnorePatterns: [ - ...baseConfig.transformIgnorePatterns, - `/node_modules/(?!${esModules}).+` - ] + transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`] }; diff --git a/{{cookiecutter.python_name}}/package.json b/{{cookiecutter.python_name}}/package.json index 77f866e..42e6a40 100644 --- a/{{cookiecutter.python_name}}/package.json +++ b/{{cookiecutter.python_name}}/package.json @@ -55,19 +55,19 @@ "stylelint:check": "stylelint --cache \"style/**/*.css\"",{% if cookiecutter.test.lower().startswith('y') %} "test": "jest --coverage",{% endif %} "watch": "run-p watch:src watch:labextension", - "watch:src": "tsc -w", + "watch:src": "tsc -w --sourceMap", "watch:labextension": "jupyter labextension watch ." }, "dependencies": { - "@jupyterlab/application": "^4.0.0-beta.0"{% if cookiecutter.kind.lower() == 'theme' %}, - "@jupyterlab/apputils": "^4.0.0-beta.0"{% endif %}{% if cookiecutter.has_settings.lower().startswith('y') %}, - "@jupyterlab/settingregistry": "^4.0.0-beta.0"{% endif %}{% if cookiecutter.kind.lower() == 'server' %}, - "@jupyterlab/coreutils": "^6.0.0-beta.0", - "@jupyterlab/services": "^7.0.0-beta.0"{% endif %} + "@jupyterlab/application": "^4.0.0"{% if cookiecutter.kind.lower() == 'theme' %}, + "@jupyterlab/apputils": "^4.0.0"{% endif %}{% if cookiecutter.has_settings.lower().startswith('y') %}, + "@jupyterlab/settingregistry": "^4.0.0"{% endif %}{% if cookiecutter.kind.lower() == 'server' %}, + "@jupyterlab/coreutils": "^6.0.0", + "@jupyterlab/services": "^7.0.0"{% endif %} }, "devDependencies": { - "@jupyterlab/builder": "^4.0.0-beta.0",{% if cookiecutter.test.lower().startswith('y') %} - "@jupyterlab/testutils": "^4.0.0-beta.0", + "@jupyterlab/builder": "^4.0.0",{% if cookiecutter.test.lower().startswith('y') %} + "@jupyterlab/testutils": "^4.0.0", "@types/jest": "^29.2.0",{% endif %} "@types/json-schema": "^7.0.11", "@types/react": "^18.0.26", diff --git a/{{cookiecutter.python_name}}/pyproject.toml b/{{cookiecutter.python_name}}/pyproject.toml index c61dba1..cffdbfd 100644 --- a/{{cookiecutter.python_name}}/pyproject.toml +++ b/{{cookiecutter.python_name}}/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0b0,<5", "hatch-nodejs-version"] +requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version"] build-backend = "hatchling.build" [project] @@ -78,7 +78,7 @@ version_cmd = "hatch version" [tool.jupyter-releaser.hooks] before-build-npm = [ - "python -m pip install 'jupyterlab>=4.0.0b0,<5'", + "python -m pip install 'jupyterlab>=4.0.0,<5'", "jlpm", "jlpm build:prod" ] diff --git a/{{cookiecutter.python_name}}/ui-tests/package.json b/{{cookiecutter.python_name}}/ui-tests/package.json index 0a71edd..4cbdd80 100644 --- a/{{cookiecutter.python_name}}/ui-tests/package.json +++ b/{{cookiecutter.python_name}}/ui-tests/package.json @@ -9,7 +9,7 @@ "test:update": "jlpm playwright test --update-snapshots" }, "devDependencies": { - "@jupyterlab/galata": "^5.0.0-beta.0", + "@jupyterlab/galata": "^5.0.0", "@playwright/test": "^1.32.0" } }