Top VSCode Python extensions
Lightrun Team
Author Lightrun Team
Top VSCode Python extensions

Top 8 VS Code Python Extensions

Lightrun Team
Lightrun Team
6 min read

Visual Studio Code (a.k.a. VS Code or VScode) is an open-source and cross-platform source code editor. It was ranked the most popular development tool in the Stack Overflow 2021 Developer Survey, with 70% of the respondents using it as their primary editor. VS Code allows you to use a few programming languages like JavaScript and TypeScript. Still, you need VS Code extensions if you want to use any other programming language or take advantage of extra tools to improve your code.

Python is one of the top computer languages used by developers worldwide for creating a variety of programs, from simple to scientific applications. But VS Code does not directly support Python. Therefore, if you want to use Python in VS Code, it is important to add good Python extensions. Luckily, there are many options available. However, the biggest challenge is to find the most complete and suitable extensions for your requirements.

Top 8 VS Code Python Extensions

To simplify your search for the most suitable Python extensions for your needs, we put together a list of the top 8 VS Code Python extensions available on the market:

1. Python (Microsoft)

Python VSCode extensions: the official Python extension

Python VS Code extension developed by Microsoft is a feature-rich Python extension that is completely free. VS Code will automatically suggest this extension when you start to create a .py file. Its IntelliSense feature enables useful functionality like code auto-completion, navigation, and syntax checking.

When you install it, the Python VS Code extension will automatically add the Pylance extension, which gives you rich language support, and the Jupyter extension for using Jupyter notebooks. To run tests, you can also use unittest or pytest through its Test Explorer feature. Other valuable capabilities include code debugging, formatting, refactoring, and automatic switching between various Python environments.

2. Lightrun

Python VSCode extensions: Lightrun

Lightrun is a real-time debugging platform that supports applications written in several languages, including Python, and is available as a VS Code extension. It consists of an intuitive interface for you to add logs, traces, and metrics in real-time for debugging code in production. You can add Lightrun snapshots to explore the stack trace and variables without stopping your live application.

Also, you can add real-time performance metrics to measure your code’s performance and synchronization, which will allow you to find performance bottlenecks in your applications. Lightrun supports multi-instance applications such as microservices and big data workers with a tagging mechanism. Lightrun it a commercial product, but it comes with a 14-day free trial.

3. Python Preview

Python VSCode extensions: Python Preview

This VS Code extension helps understand and debug Python code faster by visualizing code execution with animations and graphics. It previews object allocation and stack frames side-by-side with your code editor, even before you start debugging. This Python extension is also 100% free to use.

4. Better Comments

Python VSCode extensions: Better Comments

Comments are critical for any code as they help the developers understand the code better. The Better Comments Python extension is slightly different than the others. It focuses solely on making more human-friendly and readable comments for your Python code. With this extension, you can organize your annotations and improve code clarity. You can use several categories and colors to categorize your annotations—for example, Alerts, Queries, TODOs, and Highlights.

You can also mark commented-out code in a different style and set various comment settings as you see fit. This free VS Code extension also supports many other programming languages.

5. Python Test Explorer

Python VSCode extensions: Python Test Explorer

When developing an application, testing is a must to maintain code quality, and you will have to use different types of test frameworks. The Python Test Explorer extension for VS Code lets you run Unittest, Pytest, or Testplan tests.

The Test Explorer extension will show you a complete view of tests and test suites along with their state in VS Code’s sidebar. You can easily see which tests are failing and focus on fixing them.

In addition, this VS Code extension supports convenient error reporting. It will indicate tests having errors, and you can see the complete error message by clicking on them. If you are working with multiple project folders in VS Code, it enables you to run tests on such multi-root workspaces.

6. Python Indent

Python VSCode extensions: Python Indent

Having the correct indentation is vital when developing in Python, and adding closing brackets can sometimes get cumbersome. The Python Indent extension helps you maintain proper Python indentation in VS Code. This extension adds closing brackets automatically when you press the Tab key, which speeds up coding and enables you to save a lot of your valuable time.

It can also indent keywords, extend comments and trim whitespace lines. This free VS Code Python extension works by registering the Enter key as a keyboard shortcut, though sometimes it can unexpectedly override the Enter behavior.

7. Python Snippets 3

Python VSCode extensions: Python Snippets 3

Python Snippets 3 is a helpful VS Code extension that makes Python code snippets available while you are typing. It provides snippets like built-in strings, lists, sets, tuples, and dictionaries. Other code snippets include if/else, for, while, while/else, try/catch, etc.

There are also Python snippets for Object-Oriented Programming concepts such as inheritance, encapsulation, polymorphism, etc. Since this VS Code extension provides many Python code examples, it is helpful for beginners. However, note that this extension can sometimes add incorrect tab spaces.

8. Bracket Pair Colorizer 2 (CoenraadS)

Python VSCode extensions: Bracket Pair Colorizer

Bracket Pair Colorizer 2 is another VS Code Python extension that lets developers quickly identify which brackets pair with each other and makes it easier to read code. Matching brackets are highlighted with colors, and you can set tokens and colors that you want to use. This free VS Code extension can be even more helpful if your Python code contains nested conditions and loops.

Although marked as deprecated, this extension is still popular, and many users prefer it to the native Python bracket matching functionality that has since been added to VS Code.

Write Better Python in VS Code

The VS Code Python extensions we discussed here provide helpful features like automatic code completion, test running, indentation, useful snippets to learn Python, and adding different kinds of comments. These extensions help make code more accurate, improve readability, and detect bugs in the system.

One of these Python extensions, Lightrun, enables a robust Python debugging experience in production right from VS Code, and if this is what you need, get started with Lightrun today.


It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications.

Try Lightrun’s Playground

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.