Using Jupyter Notebooks in VS Code

in #programming15 days ago

As you probably know by now, I am a huge VS Code fan. VS Code has made all other text editors obsolete. I still use Sublime Text for my non-programming text editing, but when developing anything more than a few lines of code, VS Code is my tool of choice.

If you have been following my Python Tips series, you might have seen my post on Jupyter Notebooks. A tool I frequently use for interactive development and testing.

Jupyter notebooks is similar to an interactive python session like REPL, but your code is saved and you can integrate things like charts, dataframes, and images. I frequently use notebooks when I need to test a theory and build a complex function as it allows me to visualize data easier and get quick feedback on what I am doing.

No longer do you have to run your own Jupyter Notebooks server, you can just start a notebook directly in VS Code.

If you are doing Python development, you really need to first install the Python extension for VS Code as it adds a ton of functionality.

Once the extension is installed, you can launch a Jupyter notebook with the command palette.

Just open up the command palette with Control-Shift-P and type in Create New...

Once you do that, it will launch Jupyter and start a new notebook.

From there, you can do anything you can do in Jupyter Notebooks, directly in VS Code.

If you do not have the Jupyter packages installed, VS Code will prompt you to install it.

I also recommend you update to Python 3.8. As you can see here, this older environment is only running 3.6.5 but I wanted to change to one that didn't have the Jupyter modules installed.

Using one of the quick Pandas examples, you can see VS Code Jupyter Notebook support is fantastic and works very similar to Jupyter Notebooks.


Securely chat with me on Keybase

Why you should vote me as witness

Sort:  

Hi there, what is your opinion regarding competitive programming with VS Code? I have seen some tutorials on VS Code/Sublime text editor setup for the same, and now I am confused which way should I proceed. Any suggestions?

 15 days ago 

I have not tried competitive programming so I can’t really offer much there.

I have seen and done some collaborative and looked at a few systems that worked with sublime but I never used it much.

Sweet post, Marky! I'm also a fan of VS Code but I don't do Python.

I'd love to start seeing your posts in the Programming Community aswell as just under my Following Feed (I cross-posted this one to it, hope you don't mind). 😉

Thank you for sharing your knowledge. Publications like these encourage me to learn and research more every day about everything we can do with python. Thank you!