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
Enable jupyter labextension build/watch to work for custom jupyterlab distributions #9697
Conversation
… distributions. Currently, jupyter labextension build/watch only work for building prebuilt extensions for core jupyterlab itself. For example, the federated example directly calls the npm builder itself, and cannot use jupyter labextension build because it is pointing to the wrong core file. This adds an option to jupyter labextension build/watch to give the core package directory. If a custom JupyterLab app follows the same conventions in its package.json metadata, you can prebuild extensions for it by pointing to its package directory with --core-path.
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Nice, thanks! Wondering what the best way would be for extension authors to target several distributions at once? For example both JupyterLab and JupyterLab Classic? For now they can use the default JupyterLab core path. Should they produce two bundles / extensions, built with different |
To be safest, yes, and they should install those two different bundles into different share directories, and the jupyter classic should load its extensions from this other directory by overloading the labextension_path. The issue here is that core packages are not imported into a prebuilt extension, but if classic has a different set of core packages (in particular a more limited set), a plugin may not include a package that it needs. And really, we still need to address different versions of jlab, which also count as different distributions. |
Right, although it would be quite convenient to be able to load the same set of JupyterLab extensions automatically, without having extension authors to do extra work. Otherwise, alternative distributions would probably have to document this in their extension developer guide, and mention how to make an extension compatible with JupyterLab and the other distribution (for example by documenting how to create two bundles and distribute them under |
Should we also add a command using the jupyterlab/scripts/ci_script.sh Line 196 in 9170d39
(just to cover the use of |
Done! |
@jtpio, @blink1073 - pinging for final review and/or merge. I think I've addressed everything asked for. |
Thanks! |
@meeseeksdev please backport to 3.0.x |
…to work for custom jupyterlab distributions
Thanks! |
…7-on-3.0.x Backport PR #9697 on branch 3.0.x (Enable jupyter labextension build/watch to work for custom jupyterlab distributions)
References
Code changes
Currently, jupyter labextension build/watch only work for building prebuilt extensions for core jupyterlab itself. For example, the federated example directly calls the npm builder itself, and cannot use jupyter labextension build because it is pointing to the wrong core package.json file.
This adds an option to jupyter labextension build/watch to give the core package directory. If a custom JupyterLab app follows the same conventions in its package.json metadata, you can prebuild extensions for it by pointing to its package directory with --core-path:
jupyter labextension build --core-path=/my/custom/jlab/package /my/extension/to/build
I still left the example using the npm package builder by default to show how it can be done if you have access to the appropriate package.json.
User-facing changes
Backwards-incompatible changes