Skip to content

peregrinethan/jupyter-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

The following allows to set up a conda environment with Jupyter Lab, including extensions, and add independent Python kernels. Thanks to this setup, one can separate the IDE (Jupyter Lab) from the environment packages (like pandas, plotly, and so on). It also makes possible to test different environment, therefore different versions of the same packages.

Install the Jupyter Lab environment

The conda environment specification is stored in jupyter-lab.yml. Beyond, Jupyter Lab, the environment contains the black formatter (including the extension to use it on Jupyter Lab) and the extension for plotly charts rendering.

Install the extensions

The executable extensions.sh install some extensions into Jupyter Lab: code formatter, go to definition and spell checker. This can obviously be extended.

If you want to use the Black formatter with a keyboard shortcut, you can add to the Jupyter Lab Settings

{"jupyterlab_code_formatter:black":{
    "command": "jupyterlab_code_formatter:black",
    "keys": [
        "Ctrl K",
        "Ctrl M"
    ],
    "selector": ".jp-Notebook.jp-mod-editMode"
}}

Add the Python kernels

Once the IDE environment is set up, you can add all the Python kernels to be available in the IDE. If my_environment is the name of the conda environment, activate my_environment and run the command

python -m ipykernel install --user --name my_environment --display-name "Python (my_environment)"

Both the name and display-name can be customized.

In the image below, the above procedure has been applied to two different environments, analytics and analytics-updated. The genuine Python 3 corresponds to the native kernel from Jupyter Lab.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages