Repository: jupyterlab/extension-examples (language: python)

Issue:
Trying to run examples - warnings and errors in TL:DR first build process
Trytin to ruyn examples, following the [TL:DR](https://github.com/jupyterlab/extension-examples#tldr). I found I had to do the following to make the errors go away and get a build of the `toolbar-button` demo to build:

```bash
npm install
npm install --save-dev jest ts-jest
pip install --upgrade hatchling
```

I assume there is also a prior requirement to that of getting a recent version on node installed.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 8d290027..6014ed3a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -103,22 +103,23 @@ jobs:
       # - if: steps.filter.outputs.extension == 'true' && matrix.example == 'documents'
       #   run: |
       #     python -m pip install jupyter-collaboration
-      - name: Install the NPM dependencies
+      - name: Build the extension
         if: steps.filter.outputs.extension == 'true'
-        run: jlpm
+        run: |
+          # Same commands as in TL;DR to ensure it works
+          touch yarn.lock
+          pip install -e . -v
+          jupyter labextension develop . --overwrite
+        shell: bash
       - name: Lint the files
         if: steps.filter.outputs.extension == 'true'
-        run: jlpm run eslint:check
-      - name: Build and check by extension
+        run: jlpm run lint:check
+      - name: Check extension installation
         if: steps.filter.outputs.extension == 'true'
         run: |
-          pip install . -v
           jupyter labextension list 2>&1 | tee labextension.list
           cat labextension.list | grep -ie "@jupyterlab-examples/*.*OK"
-          # There is a JavaScript warning as jupyter-collaboration is not
-          # installed. And therefore @jupyter/docprovider is not available.
           python -m jupyterlab.browser_check
-        shell: bash
 
       - name: Install galata
         if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
@@ -217,7 +218,7 @@ jobs:
       - name: Install the Python dependencies
         if: steps.filter.outputs.extension == 'true'
         run: |
-          python -m pip install --upgrade pip jupyterlab~=4.0.0 build twine hatch
+          python -m pip install --upgrade pip jupyterlab~=4.0.0 build
       - name: Install the NPM dependencies
         if: steps.filter.outputs.extension == 'true'
         run: |
@@ -227,7 +228,7 @@ jobs:
         if: steps.filter.outputs.extension == 'true'
         run: |
           cd server-extension
-          jlpm run eslint:check
+          jlpm run lint:check
       - name: Build extension as user
         if: steps.filter.outputs.extension == 'true'
         # Force the usage of the source distribution (good practice)
@@ -340,9 +341,7 @@ jobs:
         run: jlpm
       - name: Build all the extensions
         run: |
+          # Check embedded snippets
           jlpm lint:check
-          jlpm run lerna exec --concurrency 4 -- "touch yarn.lock"
-          # Needed to generate the _version.py files
-          jlpm run lerna exec --concurrency 4 -- "pip install -e ."
           # Check links as last step as new tutorial may set links not yet valid (like file not yet in main)
           jlpm run lerna exec --concurrency 4 -- "pytest --check-links"
diff --git a/README.md b/README.md
index de403df5..2d2ebe1a 100644
--- a/README.md
+++ b/README.md
@@ -271,7 +271,7 @@ Use State persistence in an extension.
 
 Add a new button to the notebook toolbar.
 
-[![Toolbar button](toolbar-button/Preview.gif)](toolbar-button)
+[![Toolbar button](toolbar-button/preview.gif)](toolbar-button)
 
 ### [Widgets](widgets)
 
diff --git a/codemirror-extension/package.json b/codemirror-extension/package.json
index 0c56d592..3b74d4f7 100644
--- a/codemirror-extension/package.json
+++ b/codemirror-extension/package.json
@@ -52,7 +52,6 @@
     "prettier:check": "jlpm prettier:base --check",
     "stylelint": "jlpm stylelint:check --fix",
     "stylelint:check": "stylelint --cache \"style/**/*.css\"",
-    "test": "jest --coverage",
     "watch": "run-p watch:src watch:labextension",
     "watch:src": "tsc -w --sourceMap",
     "watch:labextension": "jupyter labextension watch ."
diff --git a/codemirror-extension/tsconfig.json b/codemirror-extension/tsconfig.json
index 4f3547da..98979175 100644
--- a/codemirror-extension/tsconfig.json
+++ b/codemirror-extension/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/command-palette/tsconfig.json b/command-palette/tsconfig.json
index 4f3547da..98979175 100644
--- a/command-palette/tsconfig.json
+++ b/command-palette/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/commands/tsconfig.json b/commands/tsconfig.json
index 4f3547da..98979175 100644
--- a/commands/tsconfig.json
+++ b/commands/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/completer/tsconfig.json b/completer/tsconfig.json
index 4f3547da..98979175 100644
--- a/completer/tsconfig.json
+++ b/completer/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/contentheader/tsconfig.json b/contentheader/tsconfig.json
index 4f3547da..98979175 100644
--- a/contentheader/tsconfig.json
+++ b/contentheader/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/context-menu/tsconfig.json b/context-menu/tsconfig.json
index 4f3547da..98979175 100644
--- a/context-menu/tsconfig.json
+++ b/context-menu/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/custom-log-console/tsconfig.json b/custom-log-console/tsconfig.json
index 4f3547da..98979175 100644
--- a/custom-log-console/tsconfig.json
+++ b/custom-log-console/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/datagrid/tsconfig.json b/datagrid/tsconfig.json
index 4f3547da..98979175 100644
--- a/datagrid/tsconfig.json
+++ b/datagrid/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/documents/tsconfig.json b/documents/tsconfig.json
index 4f3547da..98979175 100644
--- a/documents/tsconfig.json
+++ b/documents/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/environment.yml b/environment.yml
index 4f00ee48..f0c5a332 100644
--- a/environment.yml
+++ b/environment.yml
@@ -1,7 +1,6 @@
 name: jupyterlab-extension-examples
 channels:
   - conda-forge
-  - conda-forge/label/jupyterlab_beta
 dependencies:
   - jupyterlab >=4.0.0
   - nodejs=18
diff --git a/hello-world/tsconfig.json b/hello-world/tsconfig.json
index 4f3547da..98979175 100644
--- a/hello-world/tsconfig.json
+++ b/hello-world/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/kernel-messaging/tsconfig.json b/kernel-messaging/tsconfig.json
index 4f3547da..98979175 100644
--- a/kernel-messaging/tsconfig.json
+++ b/kernel-messaging/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/kernel-output/tsconfig.json b/kernel-output/tsconfig.json
index 4f3547da..98979175 100644
--- a/kernel-output/tsconfig.json
+++ b/kernel-output/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/launcher/tsconfig.json b/launcher/tsconfig.json
index 4f3547da..98979175 100644
--- a/launcher/tsconfig.json
+++ b/launcher/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/log-messages/tsconfig.json b/log-messages/tsconfig.json
index 4f3547da..98979175 100644
--- a/log-messages/tsconfig.json
+++ b/log-messages/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/main-menu/tsconfig.json b/main-menu/tsconfig.json
index 4f3547da..98979175 100644
--- a/main-menu/tsconfig.json
+++ b/main-menu/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/metadata-form/package.json b/metadata-form/package.json
index 51b7fea5..66152adb 100644
--- a/metadata-form/package.json
+++ b/metadata-form/package.json
@@ -53,7 +53,6 @@
     "prettier:check": "jlpm prettier:base --check",
     "stylelint": "jlpm stylelint:check --fix",
     "stylelint:check": "stylelint --cache \"style/**/*.css\"",
-    "test": "jest --coverage",
     "watch": "run-p watch:src watch:labextension",
     "watch:src": "tsc -w --sourceMap",
     "watch:labextension": "jupyter labextension watch ."
@@ -68,7 +67,6 @@
   "devDependencies": {
     "@jupyterlab/builder": "^4.0.0",
     "@jupyterlab/testutils": "^4.0.0",
-    "@types/jest": "^29.2.0",
     "@types/json-schema": "^7.0.11",
     "@types/react": "^18.0.26",
     "@typescript-eslint/eslint-plugin": "^5.55.0",
@@ -77,7 +75,6 @@
     "eslint": "^8.36.0",
     "eslint-config-prettier": "^8.7.0",
     "eslint-plugin-prettier": "^4.2.1",
-    "jest": "^29.2.0",
     "npm-run-all": "^4.1.5",
     "prettier": "^2.8.7",
     "rimraf": "^4.4.1",
diff --git a/metadata-form/tsconfig.json b/metadata-form/tsconfig.json
index 4f3547da..98979175 100644
--- a/metadata-form/tsconfig.json
+++ b/metadata-form/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/mimerenderer/tsconfig.json b/mimerenderer/tsconfig.json
index 4f3547da..98979175 100644
--- a/mimerenderer/tsconfig.json
+++ b/mimerenderer/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/notifications/package.json b/notifications/package.json
index 583836f1..9ff49fc2 100644
--- a/notifications/package.json
+++ b/notifications/package.json
@@ -52,7 +52,6 @@
     "prettier:check": "jlpm prettier:base --check",
     "stylelint": "jlpm stylelint:check --fix",
     "stylelint:check": "stylelint --cache \"style/**/*.css\"",
-    "test": "jest --coverage",
     "watch": "run-p watch:src watch:labextension",
     "watch:src": "tsc -w",
     "watch:labextension": "jupyter labextension watch ."
diff --git a/notifications/tsconfig.json b/notifications/tsconfig.json
index 4f3547da..98979175 100644
--- a/notifications/tsconfig.json
+++ b/notifications/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/react-widget/tsconfig.json b/react-widget/tsconfig.json
index 4f3547da..98979175 100644
--- a/react-widget/tsconfig.json
+++ b/react-widget/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/server-extension/README.md b/server-extension/README.md
index 1d71a97c..60366b46 100644
--- a/server-extension/README.md
+++ b/server-extension/README.md
@@ -57,7 +57,7 @@ like this (be careful to pick _server_ as _kind_):
 > The python name must be a valid Python module name (characters such `-`, `@` or `/` are not allowed).
 > It is nice for user to test your extension online, so the _set up Binder_ was set to _Yes_.
 
-The template creates creates files in the current director
+The template creates files in the current director
 that looks like this:
 
 ```bash
@@ -110,13 +110,13 @@ that looks like this:
 ├── .prettierignore
 ├── tsconfig.json              # Typescript compilation configuration
 ├── tsconfig.test.json
-├── .yarnrc.yml
+├── .yarnrc.yml                # Yarn package manager configuration
 │
 ├── src                        # Actual code of the extension
 │   ├── handler.ts
 │   ├── index.ts
 │   └── __tests__              # JavaScript unit tests
-│       └── jlab_ext_example.spec.ts
+│       └── jupyterlab_examples_server.spec.ts
 │
 ├── style                      # CSS styling
 │   ├── base.css
@@ -129,7 +129,7 @@ that looks like this:
     ├── playwright.config.js
     ├── README.md
     ├── tests
-    │   └── jlab_ext_example.spec.ts
+    │   └── jupyterlab_examples_server.spec.ts
     └── yarn.lock
 ```
 
diff --git a/server-extension/tsconfig.json b/server-extension/tsconfig.json
index 4f3547da..98979175 100644
--- a/server-extension/tsconfig.json
+++ b/server-extension/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/settings/tsconfig.json b/settings/tsconfig.json
index 4f3547da..98979175 100644
--- a/settings/tsconfig.json
+++ b/settings/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/signals/tsconfig.json b/signals/tsconfig.json
index 4f3547da..98979175 100644
--- a/signals/tsconfig.json
+++ b/signals/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/state/tsconfig.json b/state/tsconfig.json
index 4f3547da..98979175 100644
--- a/state/tsconfig.json
+++ b/state/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/toolbar-button/tsconfig.json b/toolbar-button/tsconfig.json
index 4f3547da..98979175 100644
--- a/toolbar-button/tsconfig.json
+++ b/toolbar-button/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }
diff --git a/widgets/tsconfig.json b/widgets/tsconfig.json
index 4f3547da..98979175 100644
--- a/widgets/tsconfig.json
+++ b/widgets/tsconfig.json
@@ -17,8 +17,7 @@
     "rootDir": "src",
     "strict": true,
     "strictNullChecks": true,
-    "target": "ES2018",
-    "types": ["jest"]
+    "target": "ES2018"
   },
   "include": ["src/*"]
 }


Test patch:
diff --git a/hello-world/tsconfig.test.json b/hello-world/tsconfig.test.json
index 1c66acf6..1de37fd0 100644
--- a/hello-world/tsconfig.test.json
+++ b/hello-world/tsconfig.test.json
@@ -1,3 +1,6 @@
 {
-  "extends": "./tsconfig"
+  "extends": "./tsconfig",
+  "compilerOptions": {
+    "types": ["jest"]
+  }
 }