VS Code and Python: A Natural Fit for Data Science
What do you get when you combine the No. 1 code editor with the No. 1 programming language for data science?
You get more than 60 million installs of the Python extension for Visual Studio Code, for one thing.
That's by far the most downloads of any tool in the VS Code Marketplace, which shows two companion extensions ranking in second and third place: Jupyter (40.8 million) and Pylance (33.5 million). The main Python tool has been downloaded almost 27 million more times than the most popular non-Python extension (C/C++, 33.3 million). What's more, fifth place goes to yet another Python-related tool, Jupyter Keymap, at 23.4 million installs.
So to sum all that up, Python-related VS Code offerings account for four of the top five tools and have been installed a whopping 157.8 million times!
It's no wonder, then, that a presenter at the EuroPython show in Dublin tomorrow will share "why VS Code is now the #1 tool for Python Data Scientists according to the 2021 Python Software Foundation Developer Survey, and how you can leverage VS Code to take your data science productivity to the next level" in a presentation titled "Python & Visual Studio Code - Revolutionizing the way you do data science."
The abstract for the session says: "Visual Studio Code along with GitHub, Codespaces, and Azure Machine Learning have been investing substantially into tools and platforms to make the lives of Python data scientists easier."
Indeed, the cited Python developer survey conducted last fall shows VS Code is the most popular main IDE/editor in the Python camp, even ranking above the Python-specific PyCharm IDE from JetBrains (which conducted the survey of more than 23,000 Python developers in conjunction with the Python Software Foundation).
"The combined share of the PyCharm Community and Professional editions is 31 percent, which is close to last year's result. VS Code has grown by 6 percentage points compared to last year," the survey report states.
"Interestingly, PyCharm and VS Code are equally popular among web developers (39 percent), while data scientists prefer VS Code by 9 percentage points more as their main IDE."
Also interestingly, VS Code's ascension to No. 1 in the Python developer survey has come fairly recently. In the 2018 survey, for example, it garnered only 16 percent of respondent votes, sandwiched in the No. 2 slot between No. 1 PyCharm Professional Edition and No. 3 PyCharm Community Edition.
That ascension shouldn't be too surprising, though, as Microsoft years ago went all in on the Python stakes, even hiring software engineer Don Jayamanne, who created that super-popular Python extension for VS Code mentioned above. It then put out a siren call for more Python developers.
After that, Microsoft upped the table stakes even higher, in 2020 hiring the creator of Python itself, Guido van Rossum. Microsoft recently reported that van Rossum and the company's CPython performance team have been improving the language's core runtime, which will make Python 3.1 10-60 percent faster than Python 3.10, depending on the workload.
The result of all that?
"Working with Python in Visual Studio Code, using the Microsoft Python extension, is simple, fun, and productive."
That's according to official Microsoft "Python in Visual Studio Code" guidance, which goes on to say: "The extension makes VS Code an excellent Python editor, and works on any operating system with a variety of Python interpreters. It leverages all of VS Code's power to provide auto complete and IntelliSense, linting, debugging, and unit testing, along with the ability to easily switch between Python environments, including virtual and conda environments."
A Google Trends report illustrates the climb of VS Code in general, which began to separate itself from competitors PyCharm, IntelliJ IDEA, Sublime Text and Notepad++ right around the time of that 2018 Python survey report. As the graphic below clearly shows, interest in those other IDEs/editors (even the Python-specific PyCharm) has remained fairly consistent over the past five years, while VS Code interest has climbed steadily and is still pulling away.
VS Code was also named the No. 1 code editor in the Open Source Index last year. Also last year, WakaTime, which does time tracking for programmers, released data for 2020 showing that VS Code was by far the top editor/IDE used by its coders. A 2020 Rust survey, meanwhile, again reported that VS Code was the No. 1 editor among Rust developers. And, of course, VS Code has been No. 1 in Stack Overflow's huge annual developer survey for years now.
And all those rankings listed above are general in nature, unrelated to the top use case for VS Code and Python, data science, where the editor is even more popular.
"In my opinion, two features that make it extremely attractive, that drives my definitive preference over other code editors is, extremely intelligent code completion support and seamless switch between notebook and Python files," said developer Jishnu Bhattacharya in a post last year titled "Visual Studio Code for Data Science! The More I Use, More I Like"
"It has significantly helped me improve my productivity. Trust me, you will have an experience similar to mine if you start using it," said Bhattacharya, who listed these features he found attractive:
Python Module File (.py file), Jupyter Notebook and Terminal on the same window.
- Intuitive Interface
- Superior IntelliSense
- Extensive Support of Interactive Coding
- Feature Rich Extensions Packages
- Version Control Integration with Git / GitHub.
- Customization of Settings at User and Project Level
Microsoft, of course, plays up the data science angle in its Data Science in Visual Studio Code documentation, which also emphasizes the interactivity mentioned above by Bhattacharya: "You can do all of your data science work within VS Code. Use Jupyter Notebooks and the Interactive Window to start analyzing and visualizing your data in minutes! Power your Python coding experience with IntelliSense support and build, train, and deploy machine learning models to the cloud or the edge with Azure Machine Learning service."
André Ferreira is another developer with an affinity for "VS Code for data science" thanks to its many related extensions. His own TL;DR for that April article says: "VS Code can be pretty great for data science, especially if you pick the best extensions; in this article, I share some of my favorite extensions and my configuration." Interestingly, one of those extensions is GitHub Copilot, an "AI pair programmer," speaking of data science.
Daniel Morales followed the extensions theme with his article last year titled "Top 10 Python Extensions for Visual Studio Code." After the requisite main Python extension from Microsoft mentioned above at No. 1, his list includes:
Readers interested in learning more about the special relationship among VS Code, Python and data science can tune in to tomorrow's EuroPython session mentioned above, presented by Jeffrey Mew, a product manager at Microsoft working on Python Data Science and AI tooling in VS Code. "This talk will walk through several common Python data science scenarios, showcasing all the productive tooling VS Code has to offer along the way," the abstract says. "As a sneak peek, we will be demoing a best in class Jupyter Notebooks experience with VS Code Notebooks, a revolutionary new data cleaning/preparation experience with Data Wrangler in VS Code, collaboration features with GitHub and Codespaces, Azure Machine Learning for deployment, and more!" Some on-demand viewing will be available within a couple hours after the live stream of the conference, which runs July 11-17.
Other sessions presented by Microsoft's VS Code/Python dev team at the dual in-person/remote conference include:
"Make sure you don't miss them!" said Microsoft's Luciana Abud, program manager, in a July 11 blog post about "Microsoft at EuroPython 2022."
"We'll also be at the Microsoft booth talking about the hard work our teams have been doing to continue supporting the Python community, and to improve the experience for Python developers across our products over the past year."
That could amount to a lot of talk.
About the Author
David Ramel is an editor and writer for Converge360.