Cookiecutter template to generate conda package of Jupyterlab with prepackaged extensions independent of a standard JupyterLab installation. The package created has two scripts:
- project_slug
-lab
equivalent for the bundle tojupyter lab
- project_slug
-labextension
equivalent for the bundle tojupyter labextension
To generate a recipe, you will need to install cookiecutter
.
Using conda
:
conda install -c conda-forge cookiecutter
To generate the JupyterLab bundle, you will need conda
package manager
and conda-build
package builder.
Using conda
:
conda install -c conda-forge conda-build
-
Generate a new recipe from the cookiecutter template:
cookiecutter gh:measejm1/jupyterlab_delux
-
Adapt the template to bundle the extensions you want
- Add the JupyterLab extension installation commands in
recipe/bld.bat
andrecipe/build.sh
They will have the following structurejupyter labextension install
extension_name--no-build
- Add the Jupyter server extensions needed by the JupyterLab extensions in the
run
section ofrecipe/meta.yaml
- Add the JupyterLab extension installation commands in
-
Generate the conda package
conda build -c conda-forge recipe
As displayed by the conda build
command, this will create a conda package in your anaconda/conda-bld/noarch
directory.
Comments:
- You can specify JupyterLab extension versions to install using the npm notation extension_name@version.
- You can specify JupyterLab and Jupyter server extensions versions using conda notation package =X.Y.Z or package >=X.Y.Z
- On Windows, the build process may crash due to the folder name length limit. To overcome that problem, you can specify a custom folder to build conda package into:
conda build -c conda-forge --croot C:\Temp recipe
To have a clear separation between the standard jupyterlab
and the version bundled with preinstalled extensions, we take advantage of the LabApp.app_dir
configurable property (see the
documentation).
That parameter is more easily specified through the environment variable JUPYTERLAB_DIR
as you can see in the building scripts.
To launch easily this customized JupyterLab, two entry points are created:
- project_slug
-lab
callingjupyterlab_
project_slug.labapp:main
equivalent for the bundle tojupyter lab
- project_slug
-labextension
callingjupyterlab_
project_slug.labextensionapp:main
equivalent for the bundle tojupyter labextension
This approach does not address the open question of how individual extensions should be distributed as conda packages and installed in an offline environment.
See jupyterlab/jupyterlab#2065 for discussion on that front.
This project is licensed under the terms of the BSD 3-Clause License.