Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main menu example does not add menu, just the command #265

Open
gutow opened this issue Jun 12, 2024 · 6 comments
Open

Main menu example does not add menu, just the command #265

gutow opened this issue Jun 12, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@gutow
Copy link

gutow commented Jun 12, 2024

Description

When I follow the instructions and run the main-menu example, no menu is added just the command in the command pallet.
I believe this is because some automatic loading of the schema for the menu does not work. I tried to use the code in a new project using the latest stable jupyter (^4.0.0). It behaved the same.

Reproduce

Follow the instructions in the example project.

No menu is added to Jupyter.

Expected behavior

I expect a menu to be added as per the description and animation.

Context

  • Operating System and version: Linux Ubuntu 22.04
  • Browser and version: Firefox & Chrome as of June 2024
  • JupyterLab version: version pinned in repository and ^4.0.0

In a new clean project, I am able to build a menu using code such as this:

import {
  JupyterFrontEnd,
  JupyterFrontEndPlugin,
} from '@jupyterlab/application';

import { IMainMenu } from '@jupyterlab/mainmenu';
import { ICommandPalette } from '@jupyterlab/apputils';

import {
  MenuSvg
} from '@jupyterlab/ui-components';

/**
 * Initialization data for a main menu extension.
 */
const extension: JupyterFrontEndPlugin<void> = {
  id: 'main-menu',
  autoStart: true,
  requires: [IMainMenu, ICommandPalette],
  activate: (app: JupyterFrontEnd,
      MainMenu: IMainMenu,
      palette: ICommandPalette) => {
    const { commands } = app;

    // Add a command
    const command = 'Item-1:JPSLMenu2:main-menu';
    commands.addCommand(command, {
      label: 'Item 1',
      caption: 'Item 1',
      execute: (args: any) => {
        console.log(
          `Item 1 has been called ${args['origin']}.`
        );
        window.alert(
          `Item 1 has been called ${args['origin']}.`
        );
      },
    });

    // Add the command to the command palette
    const category = 'JPSL Tools';
    palette.addItem({
      command,
      category,
      args: { origin: 'from the palette' },
    });

    // Add a menu using API
    const menu = new MenuSvg({ commands });
    menu.title.label = "JPSL Tools";
    menu.addItem({
        command: command,
        args:{label: "Item 1", origin: "from the menu"}
        });
    MainMenu.addMenu(menu);

The main-meu example in this repository is trying to do something else that does not appear to work currently.

Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.
@gutow gutow added the bug Something isn't working label Jun 12, 2024
@ohrely ohrely added the good first issue Good for newcomers label Jul 9, 2024
@krassowski
Copy link
Member

We previously discussed it in https://discourse.jupyter.org/t/how-do-i-change-available-menus-in-the-mainmenu-bar/26322/4 where I stated that there is no apparent issue in this repository because we are regularly testing the examples and there is an integration test which most recently was passing:

// Click the menu entry
await page.menu.clickMenuItem(
'Main Menu Example>Execute jlab-examples:main-menu Command'
);
expect(
logs.filter(
s => s === 'jlab-examples:main-menu has been called from the menu.'
)
).toHaveLength(1);

I re-triggered CI with #266 and the tests is still passing, on all three operating systems that we are testing:

image

@ohrely I see that you added a "good first issue" label. Did you also encounter this issue? Shall we switch the label to "help wanted" rather than "good first issue" since this appears puzzling even to seasoned contributors?

@krassowski
Copy link
Member

I also built the example locally and it works fine:

image

Here is the full log of the installation:

username:~$ git clone git@github.com:jupyterlab/extension-examples.git
Cloning into 'extension-examples'...
cd remote: Enumerating objects: 6274, done.
remote: Counting objects: 100% (2370/2370), done.
remote: Compressing objects: 100% (682/682), done.
remote: Total 6274 (delta 1831), reused 1886 (delta 1600), pack-reused 3904
Receiving objects: 100% (6274/6274), 23.69 MiB | 3.41 MiB/s, done.
Resolving deltas: 100% (3999/3999), done.
username:~$ cd extension-examples
username:~/extension-examples$ cd main-menu/
username:~/extension-examples/main-menu$ vim .python-version
username:~/extension-examples/main-menu$ pyenv virtualenv 3.10.6 main-menu-test
(main-menu-test) username:~/extension-examples/main-menu$ touch yarn.lock
(main-menu-test) username:~/extension-examples/main-menu$ python -m pip install -e .
Obtaining file://~/extension-examples/main-menu
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: jupyterlab_examples_main_menu
  Building editable for jupyterlab_examples_main_menu (pyproject.toml) ... done
  Created wheel for jupyterlab_examples_main_menu: filename=jupyterlab_examples_main_menu-0.1.0-py3-none-any.whl size=36335 sha256=f824e2d97b9d799eaf5d84cf8ab86f24e138d25ee7849b6b674e9630cf3be40a
  Stored in directory: /tmp/pip-ephem-wheel-cache-2dgib3t_/wheels/2d/2a/82/19c3488f8d34b31a3eb2df911f1ca83474cb5ff0f68719fd81
Successfully built jupyterlab_examples_main_menu
Installing collected packages: jupyterlab_examples_main_menu
Successfully installed jupyterlab_examples_main_menu-0.1.0
(main-menu-test) username:~/extension-examples/main-menu$ pip install jupyterlab
Collecting jupyterlab
  Using cached jupyterlab-4.2.3-py3-none-any.whl (11.6 MB)
Collecting traitlets
  Using cached traitlets-5.14.3-py3-none-any.whl (85 kB)
Collecting notebook-shim>=0.2
  Using cached notebook_shim-0.2.4-py3-none-any.whl (13 kB)
Collecting jupyterlab-server<3,>=2.27.1
  Using cached jupyterlab_server-2.27.2-py3-none-any.whl (59 kB)
Collecting ipykernel>=6.5.0
  Using cached ipykernel-6.29.5-py3-none-any.whl (117 kB)
Collecting jupyter-server<3,>=2.4.0
  Using cached jupyter_server-2.14.1-py3-none-any.whl (383 kB)
Requirement already satisfied: setuptools>=40.1.0 in ~/.pyenv/versions/3.10.6/envs/main-menu-test/lib/python3.10/site-packages (from jupyterlab) (63.2.0)
Collecting jupyter-core
  Using cached jupyter_core-5.7.2-py3-none-any.whl (28 kB)
Collecting packaging
  Using cached packaging-24.1-py3-none-any.whl (53 kB)
Collecting tornado>=6.2.0
  Using cached tornado-6.4.1-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (436 kB)
Collecting jupyter-lsp>=2.0.0
  Using cached jupyter_lsp-2.2.5-py3-none-any.whl (69 kB)
Collecting tomli>=1.2.2
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting httpx>=0.25.0
  Using cached httpx-0.27.0-py3-none-any.whl (75 kB)
Collecting jinja2>=3.0.3
  Using cached jinja2-3.1.4-py3-none-any.whl (133 kB)
Collecting async-lru>=1.0.0
  Using cached async_lru-2.0.4-py3-none-any.whl (6.1 kB)
Collecting typing-extensions>=4.0.0
  Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Collecting sniffio
  Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Collecting anyio
  Using cached anyio-4.4.0-py3-none-any.whl (86 kB)
Collecting certifi
  Using cached certifi-2024.7.4-py3-none-any.whl (162 kB)
Collecting idna
  Using cached idna-3.7-py3-none-any.whl (66 kB)
Collecting httpcore==1.*
  Using cached httpcore-1.0.5-py3-none-any.whl (77 kB)
Collecting h11<0.15,>=0.13
  Using cached h11-0.14.0-py3-none-any.whl (58 kB)
Collecting pyzmq>=24
  Using cached pyzmq-26.0.3-cp310-cp310-manylinux_2_28_x86_64.whl (919 kB)
Collecting comm>=0.1.1
  Using cached comm-0.2.2-py3-none-any.whl (7.2 kB)
Collecting ipython>=7.23.1
  Using cached ipython-8.26.0-py3-none-any.whl (817 kB)
Collecting jupyter-client>=6.1.12
  Using cached jupyter_client-8.6.2-py3-none-any.whl (105 kB)
Collecting matplotlib-inline>=0.1
  Using cached matplotlib_inline-0.1.7-py3-none-any.whl (9.9 kB)
Collecting nest-asyncio
  Using cached nest_asyncio-1.6.0-py3-none-any.whl (5.2 kB)
Collecting debugpy>=1.6.5
  Using cached debugpy-1.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
Collecting psutil
  Using cached psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (290 kB)
Collecting MarkupSafe>=2.0
  Using cached MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting platformdirs>=2.5
  Using cached platformdirs-4.2.2-py3-none-any.whl (18 kB)
Collecting argon2-cffi>=21.1
  Using cached argon2_cffi-23.1.0-py3-none-any.whl (15 kB)
Collecting overrides>=5.0
  Using cached overrides-7.7.0-py3-none-any.whl (17 kB)
Collecting prometheus-client>=0.9
  Using cached prometheus_client-0.20.0-py3-none-any.whl (54 kB)
Collecting websocket-client>=1.7
  Using cached websocket_client-1.8.0-py3-none-any.whl (58 kB)
Collecting terminado>=0.8.3
  Using cached terminado-0.18.1-py3-none-any.whl (14 kB)
Collecting nbconvert>=6.4.4
  Using cached nbconvert-7.16.4-py3-none-any.whl (257 kB)
Collecting send2trash>=1.8.2
  Using cached Send2Trash-1.8.3-py3-none-any.whl (18 kB)
Collecting nbformat>=5.3.0
  Using cached nbformat-5.10.4-py3-none-any.whl (78 kB)
Collecting jupyter-server-terminals>=0.4.4
  Using cached jupyter_server_terminals-0.5.3-py3-none-any.whl (13 kB)
Collecting jupyter-events>=0.9.0
  Using cached jupyter_events-0.10.0-py3-none-any.whl (18 kB)
Collecting requests>=2.31
  Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting babel>=2.10
  Using cached Babel-2.15.0-py3-none-any.whl (9.6 MB)
Collecting json5>=0.9.0
  Using cached json5-0.9.25-py3-none-any.whl (30 kB)
Collecting jsonschema>=4.18.0
  Using cached jsonschema-4.23.0-py3-none-any.whl (88 kB)
Collecting exceptiongroup>=1.0.2
  Using cached exceptiongroup-1.2.1-py3-none-any.whl (16 kB)
Collecting argon2-cffi-bindings
  Using cached argon2_cffi_bindings-21.2.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (86 kB)
Collecting pexpect>4.3
  Using cached pexpect-4.9.0-py2.py3-none-any.whl (63 kB)
Collecting stack-data
  Using cached stack_data-0.6.3-py3-none-any.whl (24 kB)
Collecting pygments>=2.4.0
  Using cached pygments-2.18.0-py3-none-any.whl (1.2 MB)
Collecting prompt-toolkit<3.1.0,>=3.0.41
  Using cached prompt_toolkit-3.0.47-py3-none-any.whl (386 kB)
Collecting decorator
  Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting jedi>=0.16
  Using cached jedi-0.19.1-py2.py3-none-any.whl (1.6 MB)
Collecting attrs>=22.2.0
  Using cached attrs-23.2.0-py3-none-any.whl (60 kB)
Collecting rpds-py>=0.7.1
  Using cached rpds_py-0.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (355 kB)
Collecting referencing>=0.28.4
  Using cached referencing-0.35.1-py3-none-any.whl (26 kB)
Collecting jsonschema-specifications>=2023.03.6
  Using cached jsonschema_specifications-2023.12.1-py3-none-any.whl (18 kB)
Collecting python-dateutil>=2.8.2
  Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Collecting python-json-logger>=2.0.4
  Using cached python_json_logger-2.0.7-py3-none-any.whl (8.1 kB)
Collecting rfc3986-validator>=0.1.1
  Using cached rfc3986_validator-0.1.1-py2.py3-none-any.whl (4.2 kB)
Collecting rfc3339-validator
  Using cached rfc3339_validator-0.1.4-py2.py3-none-any.whl (3.5 kB)
Collecting pyyaml>=5.3
  Using cached PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (705 kB)
Collecting defusedxml
  Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting nbclient>=0.5.0
  Using cached nbclient-0.10.0-py3-none-any.whl (25 kB)
Collecting mistune<4,>=2.0.3
  Using cached mistune-3.0.2-py3-none-any.whl (47 kB)
Collecting tinycss2
  Using cached tinycss2-1.3.0-py3-none-any.whl (22 kB)
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.12.3-py3-none-any.whl (147 kB)
Collecting bleach!=5.0.0
  Using cached bleach-6.1.0-py3-none-any.whl (162 kB)
Collecting jupyterlab-pygments
  Using cached jupyterlab_pygments-0.3.0-py3-none-any.whl (15 kB)
Collecting pandocfilters>=1.4.1
  Using cached pandocfilters-1.5.1-py2.py3-none-any.whl (8.7 kB)
Collecting fastjsonschema>=2.15
  Using cached fastjsonschema-2.20.0-py3-none-any.whl (23 kB)
Collecting urllib3<3,>=1.21.1
  Using cached urllib3-2.2.2-py3-none-any.whl (121 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB)
Collecting ptyprocess
  Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Collecting six>=1.9.0
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting webencodings
  Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting parso<0.9.0,>=0.8.3
  Using cached parso-0.8.4-py2.py3-none-any.whl (103 kB)
Collecting fqdn
  Using cached fqdn-1.5.1-py3-none-any.whl (9.1 kB)
Collecting webcolors>=24.6.0
  Using cached webcolors-24.6.0-py3-none-any.whl (14 kB)
Collecting uri-template
  Using cached uri_template-1.3.0-py3-none-any.whl (11 kB)
Collecting isoduration
  Using cached isoduration-20.11.0-py3-none-any.whl (11 kB)
Collecting jsonpointer>1.13
  Using cached jsonpointer-3.0.0-py2.py3-none-any.whl (7.6 kB)
Collecting wcwidth
  Using cached wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Collecting cffi>=1.0.1
  Using cached cffi-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (443 kB)
Collecting soupsieve>1.2
  Using cached soupsieve-2.5-py3-none-any.whl (36 kB)
Collecting pure-eval
  Using cached pure_eval-0.2.2-py3-none-any.whl (11 kB)
Collecting executing>=1.2.0
  Using cached executing-2.0.1-py2.py3-none-any.whl (24 kB)
Collecting asttokens>=2.1.0
  Using cached asttokens-2.4.1-py2.py3-none-any.whl (27 kB)
Collecting pycparser
  Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Collecting arrow>=0.15.0
  Using cached arrow-1.3.0-py3-none-any.whl (66 kB)
Collecting types-python-dateutil>=2.8.10
  Using cached types_python_dateutil-2.9.0.20240316-py3-none-any.whl (9.7 kB)
Installing collected packages: webencodings, wcwidth, pure-eval, ptyprocess, fastjsonschema, websocket-client, webcolors, urllib3, uri-template, typing-extensions, types-python-dateutil, traitlets, tornado, tomli, tinycss2, soupsieve, sniffio, six, send2trash, rpds-py, rfc3986-validator, pyzmq, pyyaml, python-json-logger, pygments, pycparser, psutil, prompt-toolkit, prometheus-client, platformdirs, pexpect, parso, pandocfilters, packaging, overrides, nest-asyncio, mistune, MarkupSafe, jupyterlab-pygments, jsonpointer, json5, idna, h11, fqdn, executing, exceptiongroup, defusedxml, decorator, debugpy, charset-normalizer, certifi, babel, attrs, terminado, rfc3339-validator, requests, referencing, python-dateutil, matplotlib-inline, jupyter-core, jinja2, jedi, httpcore, comm, cffi, bleach, beautifulsoup4, async-lru, asttokens, anyio, stack-data, jupyter-server-terminals, jupyter-client, jsonschema-specifications, httpx, arrow, argon2-cffi-bindings, jsonschema, isoduration, ipython, argon2-cffi, nbformat, ipykernel, nbclient, jupyter-events, nbconvert, jupyter-server, notebook-shim, jupyterlab-server, jupyter-lsp, jupyterlab
Successfully installed MarkupSafe-2.1.5 anyio-4.4.0 argon2-cffi-23.1.0 argon2-cffi-bindings-21.2.0 arrow-1.3.0 asttokens-2.4.1 async-lru-2.0.4 attrs-23.2.0 babel-2.15.0 beautifulsoup4-4.12.3 bleach-6.1.0 certifi-2024.7.4 cffi-1.16.0 charset-normalizer-3.3.2 comm-0.2.2 debugpy-1.8.2 decorator-5.1.1 defusedxml-0.7.1 exceptiongroup-1.2.1 executing-2.0.1 fastjsonschema-2.20.0 fqdn-1.5.1 h11-0.14.0 httpcore-1.0.5 httpx-0.27.0 idna-3.7 ipykernel-6.29.5 ipython-8.26.0 isoduration-20.11.0 jedi-0.19.1 jinja2-3.1.4 json5-0.9.25 jsonpointer-3.0.0 jsonschema-4.23.0 jsonschema-specifications-2023.12.1 jupyter-client-8.6.2 jupyter-core-5.7.2 jupyter-events-0.10.0 jupyter-lsp-2.2.5 jupyter-server-2.14.1 jupyter-server-terminals-0.5.3 jupyterlab-4.2.3 jupyterlab-pygments-0.3.0 jupyterlab-server-2.27.2 matplotlib-inline-0.1.7 mistune-3.0.2 nbclient-0.10.0 nbconvert-7.16.4 nbformat-5.10.4 nest-asyncio-1.6.0 notebook-shim-0.2.4 overrides-7.7.0 packaging-24.1 pandocfilters-1.5.1 parso-0.8.4 pexpect-4.9.0 platformdirs-4.2.2 prometheus-client-0.20.0 prompt-toolkit-3.0.47 psutil-6.0.0 ptyprocess-0.7.0 pure-eval-0.2.2 pycparser-2.22 pygments-2.18.0 python-dateutil-2.9.0.post0 python-json-logger-2.0.7 pyyaml-6.0.1 pyzmq-26.0.3 referencing-0.35.1 requests-2.32.3 rfc3339-validator-0.1.4 rfc3986-validator-0.1.1 rpds-py-0.19.0 send2trash-1.8.3 six-1.16.0 sniffio-1.3.1 soupsieve-2.5 stack-data-0.6.3 terminado-0.18.1 tinycss2-1.3.0 tomli-2.0.1 tornado-6.4.1 traitlets-5.14.3 types-python-dateutil-2.9.0.20240316 typing-extensions-4.12.2 uri-template-1.3.0 urllib3-2.2.2 wcwidth-0.2.13 webcolors-24.6.0 webencodings-0.5.1 websocket-client-1.8.0
(main-menu-test) username:~/extension-examples/main-menu$ jupyter labextension develop . --overwrite
Installing ~/extension-examples/main-menu/jupyterlab_examples_main_menu/labextension -> @jupyterlab-examples/main-menu
Removing: ~/.pyenv/versions/3.10.6/envs/main-menu-test/share/jupyter/labextensions/@jupyterlab-examples/main-menu
Symlinking: ~/.pyenv/versions/3.10.6/envs/main-menu-test/share/jupyter/labextensions/@jupyterlab-examples/main-menu -> ~/extension-examples/main-menu/jupyterlab_examples_main_menu/labextension
(main-menu-test) username:~/extension-examples/main-menu$ jlpm run build
Building extension in .

Compilation starting…


Compilation finished

asset remoteEntry.7fbb14978524ad05aa5e.js 27.1 KiB [emitted] [immutable] (name: @jupyterlab-examples/main-menu) 1 related asset
asset style_index_js.59e9b814d6924b1c4bcf.js 18.9 KiB [emitted] [immutable] 1 related asset
asset lib_index_js.f52a9d3df3e2e906db81.js 2.08 KiB [emitted] [immutable] 1 related asset
runtime modules 18 KiB 13 modules
built modules 11.7 KiB (javascript) 42 bytes (share-init) 42 bytes (consume-shared) [built]
  cacheable modules 11.6 KiB
    modules by path ./node_modules/ 8.58 KiB
      modules by path ./node_modules/style-loader/dist/runtime/*.js 5.84 KiB 6 modules
      modules by path ./node_modules/css-loader/dist/runtime/*.js 2.74 KiB 2 modules
    modules by path ./style/ 1.94 KiB
      ./style/index.js 21 bytes [built] [code generated]
      ./style/base.css 1.11 KiB [built] [code generated]
      ./node_modules/css-loader/dist/cjs.js!./style/base.css 829 bytes [built] [code generated]
    ./lib/index.js 1.09 KiB [built] [code generated]
  container entry 42 bytes [built] [code generated]
  provide shared module (default) @jupyterlab-examples/main-menu@0.1.0 = ...(truncated) 42 bytes [built] [code generated]
  consume shared module (default) @jupyterlab/apputils@^4.3.3 (singleton) 42 bytes [built] [code generated]
webpack 5.92.1 compiled successfully in 440 ms
(main-menu-test) username:~/extension-examples/main-menu$ jupyter lab

We really would need you @gutow or @ohrely to share a reproducible repository in which you cannot get it to work as otherwise it is hard to help. There is only one way things work but an infinite number of ways to break it.

@gutow
Copy link
Author

gutow commented Jul 10, 2024

Thank you for looking at this. I got most of the things I need working done, so have come back around to this.

A clean install of the example now works for me. I even tried messing it up by setting up a pipenv just in the main-menu example directory. It is possible that I somehow got a bad download with something missing. However, there is something still unclear about the example because I cannot get a working schema based menu starting with the copier template. Undocumented things that I tried:

  1. add "schema/*.json" to the "files" section in package.json.
  2. add "@jupyterlab/settingregistry": "^4.0.0" to the "dependencies" section in package.json (it is not used in index.ts, so I do not believe it is really needed).

There must be something more that I am overlooking as I read the various files in the example.

The example attempt is accessible here: https://github.com/gutow/minimal-jlab-menu

This example does add the working command to open the repository of the attempt to the command palette.

I think there is a documentation issue, not an outright flaw in the example. Maybe the tags should be changed to "Needs Documentation" or equivalent?

Thanks.

@ohrely ohrely removed the good first issue Good for newcomers label Jul 11, 2024
@ohrely
Copy link
Contributor

ohrely commented Jul 11, 2024

Sorry, I was too hasty with the "good first issue" label. I have not encountered the issue myself.

@krassowski
Copy link
Member

@gutow I had a quick look and it seems that you might be missing the jupyterlab.schemaDir stanza in package.json:

"jupyterlab": {
"extension": true,
"outputDir": "jupyterlab_examples_main_menu/labextension",
"schemaDir": "schema"
},

https://github.com/gutow/minimal-jlab-menu/blob/135a5ab10860d83b6d09b2f86d58d7118e45e7c0/package.json#L98-L101

It would have been added by "extension-template" if you had selected Does the extension have user settings? y but I see you did not:

https://github.com/gutow/minimal-jlab-menu/blob/135a5ab10860d83b6d09b2f86d58d7118e45e7c0/.copier-answers.yml#L7

Maybe we should reword it in the template to "Does the extension have user settings or schema-defined UI elements?"

@gutow
Copy link
Author

gutow commented Jul 12, 2024

@krassowski Thank you.

I have verified that adding "schemaDir": "schema" to the "jupyterlab" stanza solves the problem and that including "@jupyterlab/settingregistry": "^4.0.0" in the "dependencies" stanza is not necessary. Thus "@jupyterlab/settingregistry": "^4.0.0" should be removed from the example.

The change to the wording in the copier template would help. I also think there should be a check-off list of all the places things need to be set. Based on my user experience I think the list should be something like this.

The following settings are necessary for this to work (if you are building your own project from scratch and make a mistake in answering the copier template questions they may not be set correctly):

  1. "schema/*.json" should appear in the "files" section in package.json.
  2. "schemaDir": "schema" should appear in the "jupyterlab" section in package.json.
  3. "@jupyterlab/apputils" needs to be in the "dependencies" section of package.json. This should be added using jlpm add @jupyterlab/apputils if it is not there.
  4. ...
  5. There are other settings that are common to extensions and should be fine if you used the copier template.

I think that would get most JLab novices, such as myself, started.

I do have some other ideas on things that would be nice to include in this and some other examples, but do not have time to polish them into pull requests at the moment. When I find time I will do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants