7 essential VS Code extensions for Python developers in 2021
We listed the best VS extensions for JS developers. Now it’s time we do so for the Python community.
I’m a PyCharm user and I won’t probably be changing editors anytime soon, but with all the hype around VS Code and so many people over Reddit and Twitter suggesting me the switch, I had to try it.
My VS Code experience was amazing, and even though my heart still belongs to PyCharm, VS Code is a fantastic product, I can 100% recommend. It’s customizable, fast, and with a ton of extensions that make it very powerful.
Today we will cover the top VS Code extensions for Python for 2021.
VS Code supports code highlighting for Python without this extension. However, if you will be working with Python, you should install this extension. It is developed by Microsoft itself, the same creator of VS Code. It’s so essential for Python developers’ productivity that VS Code will automatically suggest that you install it right after opening your first
[Read: Meet the 4 scale-ups using data to save the planet]
But why do I need it if I already have syntax highlighting? This extension is a powerhouse of functionality when it comes to working with Python. It provides functionalities like:
- IntelliSense: Edit your code with auto-completion, code navigation, syntax checking, and more
- Linting: Get additional code analysis with Pylint, Flake8, and more
- Code formatting: Format your code with black, autopep or yapf
- Debugging: Debug your Python scripts, web apps, remote or multi-threaded processes
- Testing: Run and debug tests through the Test Explorer with unittest, pytest, or nose
- Jupyter Notebooks: Create and edit Jupyter Notebooks, add and run code cells, render plots, visualize variables through the variable explorer, visualize dataframes with the data viewer, and more
- Environments: Automatically activate and switch between virtualenv, venv, pipenv, conda, and pyenv environments
- Refactoring: Restructure your Python code with variable extraction, method extraction, and import sorting
Look at it in action:
Python Snippets is an extension full of in-built snippets packs developed by Ferhat Yalçın. This extension is great for any developer but especially for beginners in Python. It contains numerous in-built snippets such as string, list, sets, tuple, dictionary, class, and much more. Another advantage of using this plugin is that it also provides at least one example of each snippet, making it awesome while learning Python.
Download Python Snippets
Python Docstring Generator
We already talked about the importance of documentation and how much I love documenting the code, but we all know it can be a frustrating task. Python Docstring Generator diminishes the endeavor of developers by auto-creating docstrings.
The best thing about this extension is that it follows all standard formats of docstring (including Google, docBlockr, Numpy, Sphinx, and PEP0257 is coming soon), and that is cool. Moreover, this docstring generator supports args, kwargs, decorators, errors, and parameter types with multiline commenting features.
Just see it in action and be amazed:
Download Python Docstring Generator
Python Test Explorer for Visual Studio Code
The Python Test Explorer extension allows you to run your Python unittest or Pytest tests with the Test Explorer UI. This small and handy tool will enable you to test your code from VS Code’s comfort with an excellent user interface and debugging capabilities.
We know the importance of unit testing so having a tool like this on your IDE or code editor is a must-have.
Download Python Test Explorer
Python Preview is an extension that adds visual debugging to your Python code. It transforms debugging code into an interactive session with animations and graphic elements to represent your application status. You just have to see it:
Download Python Preview
Python Type Hint
Download Python Type Hint
Jupyter is one of my favorite VS Code extensions. Yes, it is what you are thinking. It’s Jupyter Notebooks directly in VS Code. As someone who’s always working with Jupyter Notebooks, this extension was beneficial, and I believe there’s still a lot I have to explore about it.
Integration with Jupyter Notebooks is one of my favorite features of PyCharm, though to be fair, I love the PyCharm integration more than I do the VS Code integration. With that said, Jupyter for VS Code is for free, while PyCharm Jupyter Notebook integration is only available in the pro version.
As I mentioned in the JS version of this post, VS Code positively surprised me. It’s a solid tool for coding fast, flexible, and with expanding features through extensions.
Interestingly, all these extensions I listed here today are some of my favorite features in PyCharm, but free of cost and with a fantastic user experience.
Still, details about the editor bug me, and so, my editor of choice is PyCharm. However, with quality extensions like this, I see how it can get hard to justify paying for it.
This article was originally published on Live Code Stream by Juan Cruz Martinez (twitter: @bajcmartinez), founder and publisher of Live Code Stream, entrepreneur, developer, author, speaker, and doer of things.
Live Code Stream is also available as a free weekly newsletter. Sign up for updates on everything related to programming, AI, and computer science in general.