Package: jupyterlab-requirements
JupyterLab RequirementsThis is a JupyterLab extension for dependency management and optimization created to guarantee reproducibility of Jupyter notebooks.AboutThis extension provides management of dependencies for JupyterLab notebooks.The main goals of the project are the following:manage notebook requirements without leaving the notebookprovide a unique and optimized environment for each notebookNOTE: The requirements are optimized using theThothresolution engine.InstallationThis extension requires:JupyterLab >= 3.1.0The extension can be installed via pip or Pipenv fromPyPI:pip install jupyterlab-requirementsYou can initialize JupyterLab and start using it.jupyter labTroubleshootIf you are seeing the frontend extension, but it is not working, check
that the server extension is enabled:jupyter server extension listIf the server extension is installed and enabled, but you are not seeing
the frontend extension, check the frontend extension is installed:jupyter labextension listUsageThere are 3 ways to interact with this extension:%horus magic commandsdirectly in your notebook’s cells.horus CLIfrom terminal or integrated in pipelines.jupyterlab-requirements UIaccessible throughManage Dependenciesbutton that appears in the notebook when it is opened in JupyteLab.Resolution enginesThere are currently two resolution engines available in the extension:ThothPipenvNOTE: Thoth is used by default and Pipenv can be triggered with flags or run as backup automatically.NOTE: Currently this extension supports onlyPythonkernels.ThothUsing the Thoth resolution engine you can request an optimized software stack that satisfies your requirements.Thoth: recommendation typeYou can choose the type of recommendation that better fits your needs:latest (default)performancesecuritystabletestingYou can find more information and updateshere.Thoth: runtime environmentThoth resolution engine is able to provide an optimized software stack based on the runtime environment you are using (several inputs are used, if you want to know more, have a look herehere).In general different runtime environment will provide different effect on you application (e.g. more performance), therefore we include these information in the notebook metadata so that other can find out what runtime environment has been used to run a certain notebook.You can select the runtime environment to be used for the recommendation selecting:Operating System NameOperating System VersionPython Interpreter VersionNOTE: Those parameters are autodiscovered by the extension and assigned to your environment, you can customize them if you are interested.Dependencies installationOnce lock file is created using any of available resolution engines, the dependencies will be installed in the virtualenv usingmicropipenv.Virtual environment for you dependenciesThe virtual environment created and assigned to the kernel to be used for your notebook according to your dependencies requirements can be checked using the following command from a terminal:cat ~/.local/share/thoth/kernels/{kernel_name}Overlays directoryThe dependencies stored in the notebook metadata can be also stored intooverlaysfolder using the kernel name by default.
If you want to know more about the use of overlays, have a lookmicropipenv.
If you want to see a practical example on the use of overlays and how to create them from your notebook, you can check thistutorial.Delete kernelsIf you have too many kernels, you can remove them directly from the JupyterLab menu under Kernel Section.
This plugin is provided from this extension.ReproducibilityYou can use this extension for each of your notebook to guarantee they have the correct dependencies files required for reproducibility and shareability. In this way, all the dependencies information required to repeat the environment are shipped with the notebook.
In the notebook metadata you will find:keynotesrequirementsAll packages required (direct dependencies).requirementsAll packages (direct and transitive dependencies) locked with all hashes (Pipfile.lock).dependency resolution engineCurrently two resolution engine are enabled.configuration fileOnly for Thoth resolution engine.All this information can allow reproducibility of the notebook.ContributingDevelopment installNOTE: You will need NodeJS to build the extension package.Thejlpmcommand is JupyterLab’s pinned version ofyarnthat is installed with JupyterLab. You may useyarnornpmin lieu ofjlpmbelow.Fork this repositoryClone the origin repo to your local environmentgit clone git@github.com:thoth-station/jupyterlab-requirements.gitChange directory to the jupyterlab-requirements directoryCreate new virtualenvpipenv install --devEnter environment.pipenv shellAll following commands needs to be run from the virtualenv created and accessed with command in point 5.Install package in development modepip install -ve . --no-cache-dirLink your development version of the extension with JupyterLabjupyter labextension develop . --overwritejupyter serverextension enable --py jupyterlab-requirements --sys-prefixRebuild extension Typescript source after making changesjlpm run buildYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension’s source and automatically rebuild the extension.The following command watch the source directory in one terminal, automatically rebuilding when needed.jlpm run watchThe following command run JupyterLab in another terminal.jupyter labWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).By default, thejlpm run buildcommand generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:jupyter lab build --minimize=FalseRun tests using the commandpython3 setup.py testWhen all tests passed and you are ready with a new contribution open a Pull Request!! We are very happy to receive contributions from the community!Demo development status and new featuresv0.13.0[Nov 22 2021]v0.11.0[Sep 13 2021]v0.10.4[Aug 10 2021]v0.9.2[Jul 19 2021]v0.8.0[Jul 9 2021]v0.7.4[Jun 22 2021]v0.5.0[Mar 15 2021]v0.3.7[Feb 10 2021]v0.1.0[Dec 8 2020]Uninstallpip uninstall jupyterlab-requirements