Best Visual Studio Code Extensions for Python

During the course of our python development experience, we have found out about these addons and have listed out the best ones in this post so that it would be very easy for you guys to use them in your projects.

In this article, we have compiled a list of the best visual studio code extensions for python that will help you in enhancing the python development in visual studio code. Visual Studio is a very powerful tool with lots of addons that helps you in editing, compiling, and debugging your python code.

Extensions for Python Development

As stated above, VS Code supports development in multiple programming languages through a well-documented extension model. The Python extension enables Python development in Visual Studio Code, with the following features:

Installing the Python extension for VSCode

Visual Studio Code extensions cover more than just programming language capabilities:

Here are some other extensions and settings I find useful:

  • GitLens provides tons of useful Git features directly in your editing window, including blame annotations and repository exploration features.
  • Auto save is easily turned on by selecting File, Auto Save from the menu. The default delay time is 1000 milliseconds, which is also configurable.
  • Settings Sync allows you to synchronize your VS Code settings across different installations using GitHub. If you work on different machines, this helps keep your environment consistent across them.
  • Docker lets you quickly and easily work with Docker, helping author Dockerfile and docker-compose.yml, package and deploy your projects, and even generate the proper Docker files for your project.

Of course, you may discover other useful extensions as you use VS Code. Please share your discoveries and settings in the comments!

Discovering and installing new extensions and themes is accessible by clicking on the Extensions icon on the Activity Bar. You can search for extensions using keywords, sort the results numerous ways, and install extensions quickly and easily. For this article, install the Python extension by typing python in the Extensions item on the Activity Bar, and clicking Install:

Finding the VSCode Marketplace in the UI

You can find and install any of the extensions mentioned above in the same manner.

Python Microsoft

First and foremost – the Python plugin for VS Code. Out of the box, there is no support for Python in the VS Code, but when you open a Python file, VS Code will immediately suggest this plugin. It adds all the necessary features like:

  • Syntax highlighting for Python files
  • Intellisense (code-completion suggestions)
  • Ability to start a debugger

This is the essential VS Code extension for Python, developed by Microsoft itself. While creating a .py file, VS Code will itself suggest installing this extension. It provides features like analyzing code for potential errors, code formatting, debugging through a debug console, testing with the unit test, pytest, and nose test frameworks. Syntax checking, auto-completion, auto-activation, and switching between different environments are also done by this extension. Moreover, it supports Jupyter Notebooks and therefore is considered as the very basic and important Python extension.

 Bracket Pair Colorizer

by CoenraadS

This extension allows matching brackets to be identified with colors. The user can define which tokens to match, and which colors to use.

Kite AutoComplete AI Code

Kite is an advancement in the direction of ease of writing code. It is based on AI which enables writing the code quickly in VS Code. When you call a function, Kite will show the arguments required to call it. If you hover on any symbol, it will show a summary regarding it. It provides quick auto-completion and shows only the right thing at a time. It can be used for different programming languages apart from Python such as JavaScript, Go, etc.

Error Lens

Sometimes the error marks in VS Code are hard to spot (especially the “info” hints). If you don’t wrap lines, it’s even worse – the error can be in the part of the code not visible on the screen.
That’s why I’m using Error Lens. It lets me modify how the errors should be displayed. It can display the error message next to the line where it occurs and a Sublime-like error icon in the gutter (next to the line number)

Python Preview

This extension is really simple but extremely handy. It brings a visual view to VSCode for Python, which makes debugging code far simpler and likely quite a bit faster.

This extension is used to preview the Python code in VS Code editor. It is very simple to use and makes debugging easy and fast. It includes graphics and animations to make visualization interesting and easy to understand the status of our code. It brings a visual view to VS Code and is specifically for Python only. It helps to visualize and ensure that what you’re trying to build is actually getting built or not.

Python Snippets

Python Snippets extension is very useful for beginners who are new to this language. It contains built-in snippets for lists, strings, dictionaries, tuples, classes, etc with at least one example of each of them. It avoids typing the code again and again by using its snippets directly. Thus, we can say this extension is beginner-friendly and saves a lot of time for Python developers.

AREPL for python

It provides code evaluation in real-time. As you start typing, the code will keep on running which helps to check if the code is right or not during the time of writing itself. If an error is found, it will be reflected in the editor instantly with logs. It can be configured accordingly to fit user experience from the settings. One doesn’t need to run the code, AREPL automatically evaluates it.

Git Graph

by Mhutchie

If you working with code I assume you use a repository to safely store it. Git graph adds another dimension to the way you use the VS Code. It adds a nice user interface of your Git history and adds the ability to create/checkout new branches with the click of a button.

GitLens Git supercharged

by Eric Amodio

This extension has at the time of writing already has more than 5 million downloads! This extension is not only a game-changer it makes sure you use Git in other ways you normally wouldn’t have used it within your CLI.

Python Indent

Every time you press the Enter key in a python context, this extension will parse your python file up to the location of your cursor, and determine exactly how much the next line (or two in the case of hanging indents) should be indented and how much nearby lines should be un-indented.

Project Manager

Do you work on multiple projects and switch back and forth? I know I do and the project manager has been a savior to manage multiple projects in visual studio code.

top 5 must have visual studio code extension - project manager

You can install it by searching the name on the extension section of the visual studio code.

Live Server

Live Server extension provides the live preview of your web application right within the editor.

This is very handy and useful for front-end developers.


You can install it by searching the name on the extension section of the visual studio

Python Preview

by Dongli

This extension is really simple but extremely handy. It brings a visual view to VSCode for Python, which makes debugging code far simpler and likely quite a bit faster.

Bookmarks

by Alessandro Fragnani

This extension lets you bookmark locations in your code, easily list all your bookmarks in a sidebar, and move between them with keyboard shortcuts.

TODO Highlight

by Wayou Liu

Highlights all TODO/FIXME/NOTE in the code, so you can easily spot them. You can easily customize it by adding new words and changing the highlight style.

Better Comments

The Better Comments extension will help you create more human-friendly comments in your code.
With this extension, you will be able to categorize your annotations into, Alerts, Queries, TODOs.

Better Comments as the name suggest helps to create comments that are easily understandable. You can easily distinguish between different types of comments like alerts, todos, queries, etc as they are colored differently in order to categorize them. However, you can also change the color setting of the comments. This extension can also be used for languages other than Python.

Pyright

Pyright is an incredibly fast static type checker and code validator. If you manage a large codebase in Python a linting tool like Pylint could be quite heavy. This extension includes the following features:

  • Intelligent type completion of keywords, symbols and import names
  • Automatically insert import statements for type completions when necessary
  • Show docstrings and type information when you hover over symbols
  • Quickly find the location of the symbol’s definition when you click on the hover over the symbols.
  • Quickly find or rename all references to a symbol within a codebase
  • Automatically reorder imports in your code according to PEP8 rules.
  • Third-party libraries have support for type stub generation

Visual Studio IntelliCode

This is a standalone extension that provides AI-assisted IntelliSense. As you might have noticed, the first extension on this list also contains IntelliSense. But in my experience, I find that this extension works better because it scans your code using AI and then does a better job with autocomplete than the Python extension from Microsoft.

Sort lines

Like the name suggests it sorts lines of text. This can be handy if you import a lot of libraries in your scripts and don’t want to reorganize them manually. if you want to have them in alphabetical order for example. To invoke the Sort lines functionality press F1 and type sort and it will automatically list the options to sort your lines. My most used sort function when I code in Python is which Sorts alphabetically but groups multi-digit numbers.

Python Docstring Generator

It makes it easy to document code in VS Code and follow standard formats. This extension generates docstring for the Python functions, and you can select from different types of docstring formats. This is supported for kwargs, args, errors, and decorators The generated docstring can be formatted as per the user requirement. It provides support for tabbed navigation i.e. when a docstring is generated, you can tab through it to add arguments.

Python Indent

This is a great tool for managing indentation in Python. It automatically gives an adequate number of space or tabs when you hit the enter button for the next line. It is one of the best Python extensions in VS Code that saves a lot of time consumed in fixing indentation errors. The main areas where it helps are between bracket pairs, extending comments, trimming whitespace lines, keyword indentation like if-elif-else, return, etc.

Python Test Explorer

The Python Test Explorer extension allows you to run your Python unit test or Pytest tests with the Test Explorer UI. It shows a Test Explorer in the Test view in VS Code’s sidebar with all the tests that are found. A failed test’s log is displayed when the test is selected in the explorer providing an excellent user interface and debugging capabilities.  

Conclusion

Visual Studio Code is one of the best IDE for development purposes but when you install it, initially it does not have support for Python. It allows JavaScript and TypeScript – however for other programming languages we need to install some plugins for VS Code to support the particular language. When you save a file in VS Code with a particular file extension, it will automatically suggest some plugins to be installed.

We have discussed the best Python extensions for Visual Studio Code. I also listed some popular plugins that can’t be categorized into a particular category.

Leave a Comment