In repo2docker we install jupyterlab for users as well as add some extensions. This works well until a repository lists jupyterlab as a dependency in its environment.yml. Then the user is greeted with a message that jupyterlab needs building because of extensions.
I think this is because repo2docker installs jupyterlab, then builds extensions and then (later) updates jupyterlab because it is mentioned in the environment.yml.
Is there a command-line tool we could run as part of repo2docker after installing all the user specified packages to detect if lab needs rebuilding?
@betatim The command jupyter labextension list will tell you whether a build is recommended. I don’t think there is any way to determine it based on return code, but the stdout will say Build recommended, please run `jupyter lab build`
There is also probably a way to determine it via python by importing jupyterlab, but I haven’t thought it through.
Took a closer look at the python approach. The build_check function returns a list of stale extensions, so something like this might be more robust than the grep approach:
from jupyterlab.commands import build, build_check
if len(build_check()) != 0:
build()
Nods. Even better would be not to need builds but in the mean time it seems better to do the build (if needed) at “image build time” instead of each time the user starts the image.