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 …]
Greetings @ NY
- Editing Python in Visual Studio Code https://code.visualstudio.com/docs/python/editing
- Working with Jupyter Notebooks in Visual Studio Code https://code.visualstudio.com/docs/python/jupyter-support
- Azure Notebooks http://notebooks.azure.com/