JupyterLab 3.0 Development Workflow

On reading some of the tutorials it wasn’t clear to me if we must execute pip install -ve . prior to executing jupyter labextension develop . --overwrite.

It appears that (and seems to make sense that) I just need to execute jupyter labextension develop . --overwrite once in order to create the link. And, then after each change, I just need to execute jlpm run build. In other words, the pip install -ve . is not necessary in the development workflow. Is that correct?

It depends on what your extension is doing. If it has a server extension included, for example, it may need to be installed with pip install -ve ..

For a lab extension that is purely a javascript extension, then I think you may be right that jupyter labextension devel . --overwrite should just work (because all we care about is getting that webpack bundle into the right place in the share directory). It worked for you, without doing the pip install?

In any case, some extensions will need to do a pip install, and it doesn’t hurt to do a pip install.

The following workflow seems to work:

  1. Activate the conda environments for development commands and for the JupyterLab server (once).
  2. Execute jupyter labextension devel . --overwrite (once) in the repository directory.
  3. Make change to index.ts (iteratively).
  4. Execute jlpm run build (iteratively).
  5. Reload JupterLab in the browser and observe change (iteratively).

It is my understanding, at present, that that workflow is sufficient for extensions that run in the browser, however it may not be sufficient for server extensions.

There is a statement in Developing a prebuilt extension that I find confusing: “While authoring a prebuilt extension, you can use the labextension develop command to create a link to your prebuilt output directory, similar to pip install -e.”

That statement seems to indicate to me that jupyter labextension devel . --overwrite can be used in place of pip install -e.

Extension development is one of the primary activities that I will be working on in a job that I started last week. I would like to help with the extension documentation, however I need to develop a better understanding of the development process.

@jasongrout

1 Like

I think I see the distinction now:

pip install -ve allows for the JupyterLab server to import the extension when it starts - similar to how it would import another extension that is not in editable mode.

jupyter labextension devel . --overwrite creates the link from the shared extensions directory to where the extension is being developed.

As you indicated, pip install -ve is relevant in the context of development of server extensions and jupyter labextension devel . --overwrite is relevant in the context of development of client extensions.

Both commands create a kind of “editable” environment for the programmer to work in.

Please let me know if any of those statements are incorrect. Thank you for your help on this.

It my understanding at present that that statement is wrong.

As I understand it, jupyter labextension devel . --overwrite is relevant in the context of development of client extensions and pip install -e is relevant in the context of development of server extensions.

Essentially, pip install -e creates a symbolic link from the python site-packages directory to the repo, so your python changes are reflected automatically. However, the data files are copied into the share directory (which is where the js is served to the client from). Note that it is a copy, not a link, so your js is not updated as you make changes in the repo.

jupyter labextension develop . --overwrite additionally creates a symbolic link from the share directory to your repo, which means your js changes will be reflected in the running jupyterlab.

1 Like

My kingdom for entry_points.