Build customized jupyerlab from source code

Hi I have a question regarding “jupyter lab build”. I was trying to change some source code in /packages and would like to build the changes in prod. However, no matter I run “jupyter lab build” with “–dev-build=False” or not. The changes that I made in /packages does not affect statics file in /opt/conda/share/jupyter/lab/, though the changes does show up in “dev_mode” folder.

I would like to know how the statics files were generated and what is the right way to build a customized jupyterlab as prod. Thanks for all your help in advance!

If you’ve installed jupyterlab from source, and changed something in packages/, you can build and run the changes by doing jupyter lab --dev-mode. This runs JLab from the dev_mode folder, where your changes are applied. A red line will appear at the top of your screen, indicating you are running from source.

It depends on what you want to do. If you want to make some changes to the core extensions, you’ll need to build your own distribution of JLab with your extensions replacing the built-in extensions. For example, you can make a new plugin from the core one and install the new one and disable the core one. Or you can build a new distribution where you pick and choose between your packages and the core packages - see the app example at https://github.com/jupyterlab/jupyterlab/tree/master/examples/app for something like this.

In general, we try to make the core flexible enough that you can make whatever customizations you need in a new extension. What exactly are you trying to do that you need to modify core extensions for?

Thanks for your feedback Jason. Right now I am not building extensions but making changes directly in src core files. I agree with you that all changes to the core should be present in the format of a new extension.

Right now I am trying to disable upload & download functionality in Jupyterlab. I think I need to override some functions in the model.ts file in /packages/filebrowser/src/. According to your comment, It seems like I should have an extension to override the upload() and download() in model.ts. But I am not sure what is the correct way to do that. May I inherit the FileBrowserModel class in my extension? how the structure of this kind of extension would look like?

Were you able to run your code changes? Even I’m trying to remove Download and Upload features but the code changes do not reflect after the build.

Make sure to run with --dev-mode - see the instructions in the contributing guide: https://github.com/jupyterlab/jupyterlab/blob/d87de688a111010cfba3165b3806498ea5109e20/CONTRIBUTING.md

FYI, recently someone contributed a change that makes it simple to disable the menu items for downloading, so all you need to do is disable a core plugin. This does not actually prevent downloading from the server, but does make it simple to remove the menu entries. See Pull out filebrowser context menu download UI into separate plugin so it can be disabled easily by DianeHu · Pull Request #10066 · jupyterlab/jupyterlab · GitHub