7 useful VS Code extensions for Python developers
The most important and useful VS Code extensions for Python developers in our new translation.
I use PyCharm and everything suits me. Chances are I won’t be changing the editor anytime soon. But there is so much hype around VS Code, so many people on Reddit and Twitter advised me to switch to VS Code, that I just couldn’t help but try it.
And it was a wonderful experience! While my heart still belongs to PyCharm, VS Code is a cool product. I can 100% recommend it. It’s customizable and fast, and the large number of extensions make VS Code very powerful and functional.
Let’s take a look at the most important VS Code Python extensions for 2021.
Python
VS Code supports code highlighting for Python without this extension. However, I still recommend installing it. The Python extension, just like VS Code itself, is developed by the Microsoft team. It is so important to the productivity of Python developers that VS Code will automatically prompt you to install it as soon as you open the first one. .py
file.
But why do we need this extension if we already have syntax highlighting? When we write Python, this extension is a powerful source of useful features:
- IntelliSense: Edit code with auto-completion, code navigation, syntax checking, and more.
- Linting: Parse code additionally with
Pylint
,Flake8
and etc. - Formatting your code: Style your code with
black
,autopep
orYAPF
… - Debugging: Debug Python scripts, web applications, and remote or multi-threaded processes.
- Testing: Running and debugging tests through Test Explorer using
unittest
,pytest
ornose
… - Jupyter Notebooks: Create and edit Jupyter notebooks, add and run code cells, draw graphs, render variables with Variable Explorer, render Dataframes with Data Viewer, and more.
- Environments: Automatic activation and switching between environments
virtualenv
,venv
,pipenv
,conda
andpyenv
… - Refactoring: Refactor your Python code with variable extraction, method extraction, and import sorting.
Check out how this extension works:
Python snippets
Python snippets Is an extension that provides built-in snippet sets that were developed by Ferhat Yalçın. This plugin is great for everyone, including beginners.
Python Snippets contains many built-in snippets such as string
, list
, sets
, tuple
, dictionary
, class
other.
Another advantage of this plugin is that it provides at least one example for each snippet, which is especially important when learning Python.
Python Docstring Generator
No one will question the importance of keeping records, but we all understand that sometimes it can be a frustrating task. FROM Python Docstring Generator minimal effort is required from developers thanks to the automatic generation of docstrings.
Especially cool is that this extension follows all standard docstring formats, including Google
, docBlockr
, Numpy
, Sphinx
and PEP0257
).
Additionally, this docstring generator supports args
, kwargs
, decorators
, errors
and parameter types, displaying them as multiline comments.
Just look at this:
Download Python Docstring Generator
Python Test Explorer for Visual Studio Code
Expansion Python Test Explorer allows you to run Python tests unittest
or Pytest using Test Explorer UI. This small and handy tool with a great user interface and debugging capabilities allows you to test your code right from VS Code.
Everyone understands the importance of unit testing, so having such a tool in an IDE or code editor is a must.
Python Preview
Python Preview Is an extension that includes visual debugging in your Python code. It turns the process of debugging your code into an interactive action with animations and graphical elements to represent the state of your application.
You should see this:
Python Type Hint
Yes, Python has something like Types. And yes, it’s cool! Type Hints for Python – like TypeScript for JavaScript. This expansion is a game changer. Hopefully we’ll see it more often in tutorials and implementations. Python Type Hint provides auto-completion hints for built-in and assumed types and the typing module.
Moreover, it can search Python files in the workspace for prediction and type determination.
Jupyter
Jupyter Is one of my favorite VS Code extensions. Yes, that’s exactly what you were thinking – Jupyter Notebooks in VS Code.
I’m the kind of person who always works with Jupyter Notebooks, this extension is really useful. And I believe that I still have a lot to learn in it.
The Jupyter Notebooks integration is one of my favorite features in PyCharm, and to be honest, I like the PyCharm integration more than the VS Code integration. However, Jupyter is free for VS Code, and PyCharm integration is only available in the pro version.
Output
VS Code pleasantly surprised me! It is a robust tool for fast, flexible coding with advanced functionality.
Funnily enough, all of the extensions listed are my favorite features in PyCharm, but in VS Code they are free but just as handy.
Some of the nuances in the VS Code editor bother me, so I still choose PyCharm. However, with the advent of such quality VS Code extensions, I understand that justifying the cost of PyCharm will become increasingly difficult.
Thanks for attention!