Most Python developers use Visual Studio Code as their editor, but they can only write Python code using the built-in toolset. This is limiting, because coding in Python can be better than that.
The best Python extension for Visual Studio Code helps users leverage their knowledge of Python to customize their development experience and make VS Code more powerful. The extension adds the ability to create virtual environments, manage packages using pip, install third-party libraries using requirements files, run scripts and executables, test and debug code, search code, run unit tests, lint code, and do many other things.
Leverage your existing knowledge of Python to customize your development experience
Best Python Extension For Visual Studio Code
We’ve searched high and low, scouring the Internet, hunting for the top 10 time-saving Python plugins (extensions, if you prefer) for VS Code. Some focus on speed and productivity, others on keeping documentation tight and tidy. Every experienced developer knows that a solid set of tools can make all the difference between a painful Python experience and a friction-free workflow – let’s get started.
Every journey starts with a first step. We suggest you start by installing Microsoft’s Python plugin. VS Code doesn’t support Python out of the box, but it will suggest the plugin once you open a Python file.
The plugin is packed with helpful features like:
- Pylint or Flake8 support for linting your code
- Syntax highlighting for Python files
- IntelliSense support for code navigation and formatting
- Support for Jupyter Notebooks, Pytest, and Unit tests
If you’re looking to find and fix bugs faster, you should definitely give Python Preview a try. Its intuitive visual style simplifies your bug hunting and helps bring your vision to reality.
Get Python Preview
With millions of installs in Marketplace, Tabnine’s AI assistant is among the most popular extensions. Loved by developers from around the world, Tabnine eliminates repetitive typing tasks with its instant inline code completions. Tabnine’s AI is trained on more than a billion lines of open source code with permissive licenses and continues to learn as you use it. Tabnine works in all of the most popular IDEs, and with your favorite languages, including Python.
Get Tabnine for VSCode
Python Docstring Generator
This is a great plugin to help you keep your module, method, class, and function documentation clear and concise. PDG follows all standard formats and has support for args, kwargs, decorators, errors, and parameter types. PDG defaults to multi-line docstring creation for an excellent commenting experience.
Get Python Docstring Generator
Python Indent is a great workaround for some of VS Code’s bad indent habits. For example, pressing enter in VS Code will move your cursor to the far left of the window. That can get annoying quickly if you’re writing Python code. Python Indent recognizes and reacts to the status of your brackets and can speed up your coding by adding a closing bracket automatically. Python Indent is an awesome upgrade that helps turn VS Code into a better Python IDE.
Get Python Indent
Everyone enjoys a good snippet now and then, especially junior devs who are just starting out. Python Snippets has loads of snippets that cover all your most common needs like string, list, sets, tuple, dictionary, class, and more. All of the snippets come with at least one example which can be a major help for determining if you’ve found the right snippet for you.
Get Python Snippets
Once you get in the flow it can be easy to forget about stopping to add proper comments. The Better Comments plugin makes it easy to circle back and add comments. You can also add styling and categorization to your comments so that they’re easy to manage and navigate during future coding sessions.
Get Better Comments
Bracket Pair Colorizer 2 (CoenraadS)
BPC2 makes it easy to identify which brackets belong to each other by color. This updated version improves upon the speed and accuracy of the original, making it far easier to read and validate your code.
Get Bracket Pair Colorizer 2
This is a massively helpful extension if you’re working as part of a development team and want to keep track of who changed what code where, how, and when. Hover your mouse over the details feature to see git blame annotations per line, per file, or in the status bar. There’s also a quick access command bar that allows you to change to the previous commit revision, open changes, do diffs, and show commit details.
Get Git Lens
If you find yourself spending heaps of time digging through documentation hunting for information about Classes, Functions, or Types, Dash may be the perfect solution for you. Dash is an API Documentation Browser and Code Snippet Manager for macOS. Simply highlight your code and press ctrl + h and Dash will serve you all the documentation you need offline.
how to install python extension in visual studio code
Visual Studio Code is a lightweight source code editor. The Visual Studio Code is often called VS Code. The VS Code runs on your desktop. It’s available for Windows, macOS, and Linux.
VS Code comes with many features such as IntelliSense, code editing, and extensions that allow you to edit Python source code effectively. The best part is that the VS Code is open-source and free.
Besides the desktop version, VS Code also has a browser version that you can use directly in your web browser without installing it.
This tutorial teaches you how to set up Visual Studio Code for Python environment so that you can edit, run, and debug Python code.
Setting up Visual Studio Code
To set up the VS Code, you follow these steps:
First, navigate to the VS Code official website and download the VS code based on your platform (Windows, macOS, or Linux).
Second, launch the setup wizard and follow the steps.
Once the installation completes, you can launch the VS code application:
Install Python Extension
To make the VS Code works with Python, you need to install the Python extension from the Visual Studio Marketplace.
The following picture illustrates the steps:
- First, click the Extensions tab.
- Second, type the
pythonkeyword on the search input.
- Third, click the
Pythonextension. It’ll show detailed information on the right pane.
- Finally, click the Install button to install the Python extension.
Let us know your thoughts in the comment section below.