So if you save a file with a .py extension for your Python code, VS Code will suggest a general plugin for that, but of course, there are other plugins apart from that one that can help to ease your work. This article lists some Visual Studio Code extensions which can be helpful in the fast and easy development of Python.
- Kite AutoComplete AI Code
- Python Preview
- Python Snippets
- AREPL for Python
- Better Comments
- Python Docstring Generator
- Python Indent
- Python Test Explorer
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.
2. Kite AutoComplete AI Code
3. Python Preview
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 build or not.
4. 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, tuple, class, 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.
5. 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.
6. Better Comments
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.
7. 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.
8. 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.
9. Python Test Explorer
The Python Test Explorer extension allows you to run your Python unittest 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.
Dash is actually an API Documentation Browser and Code Snippet Manager for macOS. This is a very important extension when you need to refer to the official documentation of Python. If you need to get more information about Classes, Functions, or Types you highlight the code, then press ctrl + h to access the official documentation offline. The benefit of having your docs offline is that you don’t need to have internet access to start coding and looking up references which allows you to focus more on the coding part.