jupyter_server icon indicating copy to clipboard operation
jupyter_server copied to clipboard

Adds fallback when `cls.__module__ == "__main__"` in `get_extension_package`

Open telamonian opened this issue 3 years ago • 2 comments

Fixes #821

Allows for running ExtensionApp modules directly as main, eg python -m jupyterlab.labapp. I personally need this for integration with the vscode debugger/python process launcher (vscode's python launcher doesn't have a concept of entry points).

Not sure if this fallback is the universal solution to all extension name vs "__main__" confusion issues, but it fixes the immediate problem. Long term, it would probably be best to scrub all mention of __module__ from the jupyter stack in favor of an explicit, required attr on ExtensionApp or elsewhere

telamonian avatar Apr 30 '22 01:04 telamonian

Codecov Report

Merging #822 (89adc76) into main (6d84507) will decrease coverage by 0.01%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #822      +/-   ##
==========================================
- Coverage   70.16%   70.14%   -0.02%     
==========================================
  Files          63       63              
  Lines        7480     7482       +2     
  Branches     1253     1254       +1     
==========================================
  Hits         5248     5248              
- Misses       1851     1853       +2     
  Partials      381      381              
Impacted Files Coverage Δ
jupyter_server/extension/application.py 72.44% <0.00%> (-0.65%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6d84507...89adc76. Read the comment docs.

codecov-commenter avatar Apr 30 '22 01:04 codecov-commenter

Long term, it would probably be best to scrub all mention of module from the jupyter stack in favor of an explicit, required attr on ExtensionApp or elsewhere

I agree and this is something we tried in the early days of extension app, but this got tricky too when calling as __main__. If the module wasn't installed, adding an explicit path didn't work either.

Zsailer avatar May 01 '22 00:05 Zsailer

Hey @telamonian, we're triaging PRs in the Jupyter Server meeting today. Because there hasn't been activity on this PR in a little while, I'm going to close it. Thanks for your work here and feel free to re-open anytime if this is in-progress.

Zsailer avatar Feb 16 '23 16:02 Zsailer