jupyter_server
jupyter_server copied to clipboard
Adds fallback when `cls.__module__ == "__main__"` in `get_extension_package`
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
Codecov Report
Merging #822 (89adc76) into main (6d84507) will decrease coverage by
0.01%. The diff coverage is0.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 dataPowered by Codecov. Last update 6d84507...89adc76. Read the comment docs.
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.
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.