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

server extension list hides invalid extensions instead of showing errors #500

Closed
minrk opened this issue May 3, 2021 · 1 comment
Closed
Labels

Comments

@minrk
Copy link
Contributor

minrk commented May 3, 2021

Description

jupyter server extension list produces unexpected output when an extension cannot be imported.

Because ExtensionPoint raises on failed import during instantiation here, and add_extension captures and logs failure to load extensions (without context) here, extensions that cannot be imported are excluded from the extension list without any information about what extension failed to load.

Output, after adding 1/0 to jupyterlab/__init__.py, effectively removes jupyterlab from the list of configured extensions:

$ jupyter server extension list
Config dir: /Users/minrk/.jupyter

division by zero  <-- detached from the extension that raised the error
Config dir: /Users/minrk/conda/etc/jupyter
    jupyterlab_code_formatter enabled
    - Validating jupyterlab_code_formatter...
      jupyterlab_code_formatter 1.4.4 OK
    nbclassic enabled
    - Validating nbclassic...
      nbclassic  OK
    voila.server_extension enabled
    - Validating voila.server_extension...
      voila.server_extension  OK

I think one option is to defer import validation to the .validate() step, and not swallow errors. There appears to be some inconsistency about whether .validate() should raise on invalid (as expected here) or swallow errors and return True/False, as expected here.

Given the number of layers, I think it probably makes the most sense to let validation raise, because that lets the outermost caller (i.e. ListServerExtensionApp.run) wrap and re-display the error message, whereas True/False makes it hard for the error turned into False in ExtensionPoint.validate to be effectively displayed to the user in jupyter serverextension list to be fixed. log.warning in ExtensionPoint.validate might be sufficient, though.

Reproduce

  1. install a server extension
  2. make it not importable (e.g. by adding 1/0 to the module.py)
  3. jupyter server extension list and look for information about the extension that's failing to load

Expected behavior

Informative error associated with the extension that failed to load; something more like

Config dir: /Users/minrk/conda/etc/jupyter
    jupyterlab enabled
    - Validating jupyterlab...
      X jupyterlab: zero division error

Context

  • Operating System and version: macOS 11.3
  • Jupyter Server version: 5e77b73
@blink1073
Copy link
Contributor

This was fixed by #1139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants