Jupyter lab and Visual Studio Code together

Visual Studio Code is a free tool for coding and it is very powerful, used by a lot of programmers. Jupyter lab is another tool that is very famous and it is used to code in python for so many use cases. Now you can use them together. See how in the video below.

A comfortable experience coding with jupyter lab directly into Visual Studio Code… what else could you desire to make your projects? You can also save your code and convert it in nbpy files to open them into jupyter lab and viceversa, for the need you have.

How to use it

Open Visual studio code in a folder.

Open view / command palette

Then choose Python: Select Interpreter

Choose the Python installation where you installed jupyter lab.

If you do not have it installed, use pipand install it with:

pip install jupyterlab

Start a new file

In a new file (file.py for example), write:

#%%

 

and then write the regular code.

You will see some labels above #%% when you write this symbols, it means it is working.

Each cell will start with this #%%.

Run a cell

You can use the label above #%% with run cell, or press crtl + enter or shift + enter, like you do in juyter lab or jupyter notebook (lupyter lab is an evolution of jupyter notebook).

Markdown language

You can also use markdown writing

#%% [markdown]

Convert .py yo .nbpy

You can also convert the file .py you are writing with the #%% into a notebook file nbpy

You can see the icon on the top right corner of the image above the chance to export the code as a jupyter notebook. You can even open it immediately after you saved it and run it in jupyter in the browser. So there is a lot of versatility in the use of the code.

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.