Python in Visual Studio Code

Spread the love

Python is an interpreted, high-level, general,purpose programming language which has been popular all over the world and is becoming the most sought after choice for simple programming scripts to highly sophisticated data engineering solutions.

Python in general is used more in data science, artificial intelligence and network scripting, it is also becoming a popular option for web development projects of large and small scale due to frameworks like Django, Pyramid and flask etc.

Implementation of microservice using python microservices framework like Nameko.The trend of using python has been on the rise in recent years and it is not showing any signs of slowing down. Hence the topic of which editor or IDE is more suitable for python programming is also becoming a relevant topic among the peers who are involved in various usage scenarios of python. Here we are going to discuss how Visual Studio Code, an open source lightweight cross platform code editor can be used as an editor for python programming.Visual Studio Code or simply VS Code is an open source code editor provided by Microsoft. VS code have support for programming languages such as C++, C#, CSS, Dockerfile, Go, HTML, Java, JavaScript, JSON, Less, Markdown, PHP, PowerShell, Python, SCSS, T-SQL , TypeScript. Several programming languages like JavaScript, HTML, CSS, etc are supported by default while others require an integrated extension to be installed. Since its release in 2015 VS code has been steadily gaining momentum as a popular solution for cross platform code editor. It has built in Git and debugging options which are fairly easy to use and does not require much fiddling to configure these.

There are advantages and disadvantages for using VS Code for python development when it is compared to a proper IDE which has all sorts of features and services designed for python development by default.For python development, we initially need to add the python extension from the extension library(Marketplace) by simply browsing and installing from extensions view within the VS Code editor.Additional modules may be needed for support for frameworks like Django,Anaconda extension pack for those who use Anaconda python distribution etc. Since it is just a code editor not a fully fledged Integrated Development Environment(IDE) the additional extensions play a huge role in adding the support and functionality that a proper python IDE like PyCharm provides by default. The extensions enable various functionality to an extent which makes it possible to upgrade VS Code as a lightweight IDE more than just a code editor.

In some cases if you are working on server side and client side code development together(for example Django on server side and Angular on client side) then VS code might be an ideal solution as it supports multiple programming languages unlike a standalone IDE dedicated to python. Compared to a traditional IDE VS code has better performance taken into consideration that start up time required is low, the resource consumption is low(it requires less RAM and processing power). The performance edge that it has is mainly due to being a code editor and not an IDE. It also has the option to specify which virtual environment that we want to use for our project if virtual environments are used which in the case of python generally most projects will be running inside a virtual environment for the ease of handling the python modules for allowing it to be  independent from system python modules. In terms of cons the modules required are loaded after a file is opened which causes a slight delay in syntactic and semantic issues to be shown(even in worst cases the delay is less than a minute).This is not an issue considering it does not haggle on resource to load module during the start up time which sometimes affect the performance. Another of its disadvantages are that some of the features that professionals use are missing here. These can also be forgiven as most won’t be needing any of these. At last since the UI is mostly borrowed from Visual Studio, a proprietary IDE solution provided by Microsoft themselves some might find it not to their liking. Some of the functions and features of VS Code are difficult to  find and use initially but once you are used to it for a few days this also won’t be an issue.If you compare VS Code to any other readily available alternatives which are free to use, VS Code has the upper hand in almost all scenarios. But if you are considering paid professional solutions such as PyCharm Professional by JetBrains it loses out on many in box features but that solemnly depends upon whether you need to pay for a professional IDE. In conclusion, keeping the fact that VS Code is a code editor which can be customised to the most as a lightweight IDE, in most scenarios VS Code is a tool that can be used for python development without any issues. Another fact that needed to be highlighted here is that the community support that VS code has is tremendous and one can always depend on it for support. Lastly in case if VS code misses out on any feature there is always the option to create an extension for the feature that you want yourself if you can spend your time and resources for it.