What is the most stable way to run lab/notebook7 with my extension?

Hello.

I have an extension and I want to run lab with it. I can create custom config and pass path as argument but is there anything like --enable-extension=..?

1 Like

Please deifne stable. What are you tring to achieve, what would you like this flag to help you with?

I have a compiled extension in some directory and I want Jupyter lab to include it when I start lab.
I can copy extension to the data/labextensions somewhere in my home directory, but is it possible to have something like

jupyter lab --enable-extension=path/to/extension

?

By “stable” I mean official, recommended approach that wouldn’t be changed. Not a hack.

Thank you.

Why dont you install the extension in the same environment where you run jupyter lab? In that case, lab will pick up all extension related stuff automatically.

In a case that you do not want to install the extension in the current env, you will need to rely on JUPYTER_CONFIG_PATH env var to point it to path/to/etc/jupyter and JUPYTER_PATH to point to /path/to/share/jupyter. The env var JUPYTER_CONFIG_PATH will enable the extension and JUPYTER_PATH will load necessary transpiled JS code. In case if you have backend python modules that your extension needs, you will need to set PYTHONPATH as well. More details on jupyter --paths is in docs.