#VSCode – Edit and work with #jupyter notebooks in Visual Studio Code

Hi !

I’ve been using Python and Jupyter notebooks more and more. And somehow, during this learning path I also realize that I can use Visual Studio Code to code amazing Python apps, and also to edit and work with Jupyter notebooks.

If you are VSCode python developer, you may know some of the features available in the tool. I won’t describe them, because you may find the official documentation very useful (see below links or references).

The Python extension provides many features for editing Python source code in Visual Studio Code:

However, during the part months I’ve also working a lot using Jupyter notebooks, and I was very happy when I realize that VSCode also have some cool features to work with notebooks. The core of the notebooks are cells, and we can use them with the prefix #%%.

This is how it looks inside the IDE, running a cell in the code

Another interesting feature is to run notebooks in a remote Jupyter server, maybe using Azure Notebooks. I haven’t tried this one, and it’s on my ToDo list for the near future.

On top of adding cells features into standard python [.py] files, we can also edit standard Jupyter files. I’ve installed jupyter into one of my anaconda local environments, and now I can edit files inside VSCode.

First, I’ll be prompted to import the file as a standard python file

And, done! Now I got my Jupiter notebook inside VSCode

The final step will be to export my file or debug session, and for this we have the command [Python: Export …]

Super useful!

Happy coding!

Greetings @ NY

El Bruno



One thought on “#VSCode – Edit and work with #jupyter notebooks in Visual Studio Code”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.