Building extension has no effect


We are developing a JupyterLab extension, however, calling jlpm run build does not update the extension anymore. The building process itself runs successfully, but after reloading the site (either running on JupyterHub or standalone JupyterLab) it does not reflect the updated code.

In order to see the code changes, we have to run pip install -e . ; jlpm run build ; pip install -e ., which is not exactly efficient. At least that’s the simplest process we could find. Running jlpm run watch also has no effect.

Is there anything we can check to find the cause of the problem? Are there any resources to find which files are updated in the process?

Thanks for your help!

Edit: The package was also moved into a namespace package if that helps in any way.

That’s… not a lot to work with.

  • what OS?
  • what version(s) of jupyterlab are you expecting it to work on?
  • is it open source?

Try running more things with --debug and --verbose flags, and really try to give some of the stuff a read.

Assuming lab 3

  • you’re try to get
    • the contents of a “full” built labextension
      • as specified in package.json#/jupyterlab/outputDir
    • to {sys.prefix}/share/jupyter/labextensions/<your package name>
  • by either
    • (unix or windows) copy it into place
    • (unix) symlink that yourself (that’s all jupyter lab --develop does)

Regarding the namespace package, I had to do some junk like this:

This may have been fixed up stream. Don’t know, though. But yeah, support for them is relatively poor across tooling, and you’ll likely need to do some work around for various things.

Yeah you are right that was indeed very vague…

Here’s a bit more information:

  • OS: Ubuntu 20.04
  • jupyterlab version is 3.0.14
  • the project is not open source right now but will become open source once it is more mature

We followed the steps in the Extension Tutorial except we did not set up a conda environment. I think we noticed the problem once we moved from backend to frontend development after moving the project in a namespace package.

Thanks for your answer and suggestions!

Ok, so after trying to trace the steps of the building process I have come to the following conclusions:

  • jlpm run build correctly builds in /home/<user>/<src root>/<labextension name>/<namespace>/<labextension name>/lib
  • jupyter labextension develop . --overwrite creates a symlink of:
    /home/<user>/venv/share/jupyter/labextensions/<name> -> /home/<user>/<src root>/<labextension name>/<namespace>/<labextension name>/labextension

The lib directory is updated each time jlpm run build is run. The labextension directory is only updated by installing with pip install -e . and thus updates the symlink and the extension.

So I guess my question is: Why does jlpm run build not update the outputDir (labextension directory that is symlinked) but only lib?

Everything in the package.json file is from the Cookiecutter package.json.

Perhaps it’s not linked?

jupyter labextension develop --overwrite .

Does it work if you run jupyter labextension develop --overwrite . after pip install -e .?

Thanks for your help! I managed to manually link it because it seems like pip install -e . and jlpm run build output to different directories. When manually symlinking the extension gets correctly updated after building. However, now jupyter labextension develop --overwrite . fails because it says it does not find a labextension in . This may be the case because the output dir of the package.json contains a subdirectory but this only occurred after symlinking manually I think.

For now I will try to refactor the code into separate packages again instead of using namespace packages to simplify the process. This will hopefully resolve the errors.