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 .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: Additionally, parse the code with Pylint



    , Flake8



    etc.
  • : black



    , autopep



    YAPF



    .
  • : Python-, -, .
  • : Test Explorer unittest



    , pytest



    nose



    .
  • Jupyter Notebooks: Jupyter, (code cells), , Variable Explorer, Dataframe Data Viewer . .
  • : virtualenv



    , venv



    , pipenv



    , conda



    pyenv



    .
  • : Python , .




See how this extension works:







β†’ Download Python extension



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



and others.



Another advantage of this plugin is that it provides at least one example for each snippet, which is especially important when learning Python.



β†’ Download Python Snippets



Python Docstring Generator







No one will question the importance of keeping records, but we all understand that sometimes it can be a frustrating task. The Python Docstring Generator requires minimal effort on the part of developers thanks to the automatic generation of docstrings.



Especially cool that this extension should be all the standard format strings documentation, including Google



, docBlockr



, Numpy



, Sphinx



and PEP0257



).



Furthermore, the documentation generator lines 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







The Python Test Explorer extension allows you to run Python unittest



or Pytest tests using the Test Explorer UI. This small and handy tool with great user interface and debugging capabilities will allow 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.







β†’ Download Python Test Explorer



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 activity with animations and graphical elements to represent the state of your application.



You should see this:







β†’ Download Python Preview



Python Type Hint







Yes, Python has something like Types. And yes, it's cool! Type Hints for Python are 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.







β†’ Download Python Type Hint



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.



β†’ Download Jupyter



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 it will be more difficult to justify the cost of PyCharm.



Thanks for attention!



All Articles