Build jupyterlab from the source and deploy

How to run jupyterlab build from source or github master ? It works fine with jupyter lab --dev-mode. But how can the same be achieved without the --dev-mode ? Tried few things, but starting it as jupyter lab always ends up picking the code from the node_modules ! I’ve created a fork and made few changes in packages. What would be the way to a prod build from the fork and pick that on running jupyter lab ?

That’s the way to run from the sources. That’s exactly the purpose of the --dev-mode switch.

Yes, but with dev mode extensions aren’t enabled! Say if we have few changes in the fork which arent merged in the actual jupyter lab repo. How to do a build from the fork source while still having extensions enabled ??

Testing third-party extensions against a from-source install of jlab is indeed harder. There are some ways of doing this documented in the development docs: https://jupyterlab.readthedocs.io/en/stable/developer/extension_dev.html#extension-authoring (look for “add:sibling”)

yeah, checked it out. But i’m trying to avoid the dev mode and look out for how does jupyter lab releases are built ! And Similarly how a fork can have its own releases that’ll contain its own flavour of code changes ? Any doc on what tasks are run to prepare a release ? npm run publish:all ?

The JLab release instructions are at https://github.com/jupyterlab/jupyterlab/blob/ad0f1a5bc745a32086403cb89b98f33c09756e98/RELEASE.md

What’s the quick story on “jlpm run build:core” ? I’ve used that to install a locally built JupyterLab and it seemed to work alright (no dev mode red line, extensions work).

jlpm run build:core looks like it is just building in the staging directory: https://github.com/jupyterlab/jupyterlab/blob/3428496b0c2d00f2b62bda29e784c0b81283abe6/package.json#L26

I don’t use jlpm run build:core myself. It does seem like it wouldn’t include extensions you’ve installed, only core extensions, and it seems like it also won’t include the source, just the packages referred to in the staging directory. In other words, it seems like it is just rebuilding the js you’d run if you ran jupyter lab --core-mode.

Is there any reference where any organisations/individuals have their own fork, do changes and have it running (prod build from source with all extensions),which kind-off avoids waiting on the opensource PR to be merged or any org specific change to be made. We are thinking of having a similar setup and we had earlier done it with jupyter notebook, where it was quite straight forward to build from sources. Finding it a bit difficult to crack it with jupyterlab also being a monorepo!

If you do not need users to be able to install extensions (i.e., building a monolithic jlab with all needed plugins at the start), I strongly suggest using the example app as a basis for a package. It lets you pick and choose what plugins to use (and you can use forked versions of the main plugins if you like), and greatly simplifies the build and packaging process.