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

jupyter labextension watch --help crashes with a KeyError #15540

Closed
akx opened this issue Dec 19, 2023 · 3 comments · Fixed by #15542
Closed

jupyter labextension watch --help crashes with a KeyError #15540

akx opened this issue Dec 19, 2023 · 3 comments · Fixed by #15542
Labels
bug good first issue status:Needs Triage Applied to new issues that need triage
Milestone

Comments

@akx
Copy link
Contributor

akx commented Dec 19, 2023

Description / Reproduce

~ $ docker run -it python:3.12 bash
# pip install jupyterlab
Successfully installed MarkupSafe-2.1.3 anyio-4.2.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.1.0 babel-2.14.0 beautifulsoup4-4.12.2 bleach-6.1.0 certifi-2023.11.17 cffi-1.16.0 charset-normalizer-3.3.2 comm-0.2.0 debugpy-1.8.0 decorator-5.1.1 defusedxml-0.7.1 executing-2.0.1 fastjsonschema-2.19.0 fqdn-1.5.1 idna-3.6 ipykernel-6.27.1 ipython-8.18.1 isoduration-20.11.0 jedi-0.19.1 jinja2-3.1.2 json5-0.9.14 jsonpointer-2.4 jsonschema-4.20.0 jsonschema-specifications-2023.11.2 jupyter-client-8.6.0 jupyter-core-5.5.1 jupyter-events-0.9.0 jupyter-lsp-2.2.1 jupyter-server-2.12.1 jupyter-server-terminals-0.5.0 jupyterlab-4.0.9 jupyterlab-pygments-0.3.0 jupyterlab-server-2.25.2 matplotlib-inline-0.1.6 mistune-3.0.2 nbclient-0.9.0 nbconvert-7.13.0 nbformat-5.9.2 nest-asyncio-1.5.8 notebook-shim-0.2.3 overrides-7.4.0 packaging-23.2 pandocfilters-1.5.0 parso-0.8.3 pexpect-4.9.0 platformdirs-4.1.0 prometheus-client-0.19.0 prompt-toolkit-3.0.43 psutil-5.9.7 ptyprocess-0.7.0 pure-eval-0.2.2 pycparser-2.21 pygments-2.17.2 python-dateutil-2.8.2 python-json-logger-2.0.7 pyyaml-6.0.1 pyzmq-25.1.2 referencing-0.32.0 requests-2.31.0 rfc3339-validator-0.1.4 rfc3986-validator-0.1.1 rpds-py-0.15.2 send2trash-1.8.2 six-1.16.0 sniffio-1.3.0 soupsieve-2.5 stack-data-0.6.3 terminado-0.18.0 tinycss2-1.2.1 tornado-6.4 traitlets-5.14.0 types-python-dateutil-2.8.19.14 uri-template-1.3.0 urllib3-2.1.0 wcwidth-0.2.12 webcolors-1.13 webencodings-0.5.1 websocket-client-1.7.0
# jupyter labextension watch --help .
Failed collecting help-message for alias 'development', due to: 'BuildLabExtensionApp'
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-labextension", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jupyter_core/application.py", line 281, in launch_instance
    super().launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 1076, in launch_instance
    app.initialize(argv)
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 118, in inner
    return method(app, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jupyter_core/application.py", line 252, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 118, in inner
    return method(app, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 858, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 118, in inner
    return method(app, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 722, in initialize_subcommand
    self.subapp.initialize(argv)
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 118, in inner
    return method(app, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jupyter_core/application.py", line 252, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 118, in inner
    return method(app, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 870, in parse_command_line
    self.print_help("--help-all" in interpreted_argv)
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 634, in print_help
    print("\n".join(self.emit_help(classes=classes)))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 643, in emit_help
    yield from self.emit_options_help()
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 596, in emit_options_help
    yield from self.emit_alias_help()
  File "/usr/local/lib/python3.12/site-packages/traitlets/config/application.py", line 534, in emit_alias_help
    cls = classdict[classname]
          ~~~~~~~~~^^^^^^^^^^^
KeyError: 'BuildLabExtensionApp'
#

Not much to diagnose: the command doesn't work.

Expected behavior

Help for labextension watch should work.

Context

  • Operating System and version: any, likely; reproducable on macOS and a Linux Docker container
  • JupyterLab version: 4.0.9
Troubleshoot Output
$PATH:
	/usr/local/bin
	/usr/local/sbin
	/usr/local/bin
	/usr/sbin
	/usr/bin
	/sbin
	/bin

sys.path:
/usr/local/bin
/usr/local/lib/python312.zip
/usr/local/lib/python3.12
/usr/local/lib/python3.12/lib-dynload
/usr/local/lib/python3.12/site-packages

sys.executable:
/usr/local/bin/python

sys.version:
3.12.1 (main, Dec 9 2023, 00:02:46) [GCC 12.2.0]

platform.platform():
Linux-6.5.11-linuxkit-aarch64-with-glibc2.36

which -a jupyter:
/usr/local/bin/jupyter
/usr/local/bin/jupyter

pip list:
Package Version
------------------------- ----------
anyio 4.2.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.1.0
Babel 2.14.0
beautifulsoup4 4.12.2
bleach 6.1.0
certifi 2023.11.17
cffi 1.16.0
charset-normalizer 3.3.2
comm 0.2.0
debugpy 1.8.0
decorator 5.1.1
defusedxml 0.7.1
executing 2.0.1
fastjsonschema 2.19.0
fqdn 1.5.1
idna 3.6
ipykernel 6.27.1
ipython 8.18.1
isoduration 20.11.0
jedi 0.19.1
Jinja2 3.1.2
json5 0.9.14
jsonpointer 2.4
jsonschema 4.20.0
jsonschema-specifications 2023.11.2
jupyter_client 8.6.0
jupyter_core 5.5.1
jupyter-events 0.9.0
jupyter-lsp 2.2.1
jupyter_server 2.12.1
jupyter_server_terminals 0.5.0
jupyterlab 4.0.9
jupyterlab_pygments 0.3.0
jupyterlab_server 2.25.2
MarkupSafe 2.1.3
matplotlib-inline 0.1.6
mistune 3.0.2
nbclient 0.9.0
nbconvert 7.13.0
nbformat 5.9.2
nest-asyncio 1.5.8
notebook_shim 0.2.3
overrides 7.4.0
packaging 23.2
pandocfilters 1.5.0
parso 0.8.3
pexpect 4.9.0
pip 23.2.1
platformdirs 4.1.0
prometheus-client 0.19.0
prompt-toolkit 3.0.43
psutil 5.9.7
ptyprocess 0.7.0
pure-eval 0.2.2
pycparser 2.21
Pygments 2.17.2
python-dateutil 2.8.2
python-json-logger 2.0.7
PyYAML 6.0.1
pyzmq 25.1.2
referencing 0.32.0
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.15.2
Send2Trash 1.8.2
setuptools 69.0.2
six 1.16.0
sniffio 1.3.0
soupsieve 2.5
stack-data 0.6.3
terminado 0.18.0
tinycss2 1.2.1
tornado 6.4
traitlets 5.14.0
types-python-dateutil 2.8.19.14
uri-template 1.3.0
urllib3 2.1.0
wcwidth 0.2.12
webcolors 1.13
webencodings 0.5.1
websocket-client 1.7.0
wheel 0.42.0

@akx akx added the bug label Dec 19, 2023
@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label Dec 19, 2023
Copy link

welcome bot commented Dec 19, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@jtpio
Copy link
Member

jtpio commented Dec 19, 2023

Thanks @akx for the report!

It looks like the aliases defined here refer to BuildLabExtensionApp instead of WatchLabExtensionApp:

aliases = {
"development": "BuildLabExtensionApp.development",
"source-map": "BuildLabExtensionApp.source_map",
"core-path": "BuildLabExtensionApp.core_path",
}

Updating with the following code should help fix it:

aliases = {
    "development": "WatchLabExtensionApp.development",
    "source-map": "WatchLabExtensionApp.source_map",
    "core-path": "WatchLabExtensionApp.core_path",
}

Would you like to open a PR? Thanks!

@jtpio jtpio added this to the 4.0.x milestone Dec 19, 2023
@akx
Copy link
Contributor Author

akx commented Dec 19, 2023

Would you like to open a PR? Thanks!

Sure thing! Took a while to get to that point because of lunch and #15541...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue status:Needs Triage Applied to new issues that need triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants