6 Visual code extensions to improve your python code


6 Visual code extensions to improve your python code
6 Visual code extensions to improve your python code

Today I’m going to discuss about 6 visual studio code extensions to improve your python code. Lets face it we all spend a lot of hours in front of an editor for some of us it has become our second bed. Yes after spending countless of hours in using Visual Studio Code eventually you will want all the help you can to make your life better. It’s like improving your bedding and investing in an expensive mattress you know it’s worth it if you are spending a third of your day on it, in a similar way the investment on having a nice setup for your coding is important. Ok maybe some of you do not spend 8 hours straight in Visual Studio Code but if you are spending a good amount of your day it’s worth to spend a few minutes customizing and improving it.

In the past I was always a die hard emacs guy, in fact I only transitioned to Visual Studio Code 7 years ago, so I spent most of my career on emacs (over 15 years). And while Emacs is still a great editor it showed signs of aging and it was time for a change. But let me tell you a little about how life used to be before Visual Studio Code. Well you guessed it right I spent a lot of time coding in lisp extensions to make my emacs experience better. In fact I spent so much time I had created a special git repository for it to automate a lot of my day to day tasks. I’m not going to lie sometimes I miss a few of the things I used to do with emacs such as connecting to my favorite IRC channels, having an encrypted journal and todo list, automatically signing my git commits and a lot of other automation I had built into it.

So a lot of people ask me why change if you have all of this? Well the answer is simple Visual Studio Code has a powerful thing going and this is the extensions community it has built. A lot of the things I used to spend my weekend or sometimes a week worth implementing myself I now get it for free, not only that I also get free support and updates on it. Who wouldn’t want that right? Well sort of, I have to admit that a lot of the extensions are good but some miss my expectations especially coming from an emacs world where generally speaking things just worked. I don’t know if I can attribute this specifically to lisp being difficult and only smart coders picking it up or people just cared more back then about performance and stability than now. This would be an answer that I would leave unanswered, hey if you have any thoughts on it please drop me a comment below I would be interested to hear your opinion on it.

A bit about me, I have been working in the Software industry for over 23 years now and I have been a software architect, manager, developer and engineer. I am a machine learning and crypto enthusiast with emphasis in security. I have experience in various industries such as entertainment, broadcasting, healthcare, security, education, retail and finance.

Understanding the risks

Risks of Visual Code Extensions
Risks of Visual Code Extensions

Anyway enough of this emacs vs visual studio code fluff most of you came here to read about useful extensions. The reason I went into the detail above is that I want to make it clear about some things.

  • The extensions are maintained by a community of developers so updates and quality is always dependent on that. There are some extensions that more popular and maintained by bigger companies such as Microsoft but I would say the majority is not.
  • There may be security or incompatibility issues with the version of Visual Studio Code you are using. Even though Microsoft claims to have a lot of security practices in place and sandboxing ultimately you are trusting some third party with your editor and more specifically sensitive stuff such as your code.
  • Reliability and performance, I have used some extensions in the past that have made my editor and generally my computer slow. The reason is there were coding mistakes that broke them among updates and vastly affected the performance and experience of my system. So always be wary of such a thing happening if you notice it start by disabling them one by one until you find the culprit. If you want to be a good netizen go ahead and report the issue to the developer so he can resolve it in the future as most of the problems are done by mistake, after all we are part of a bigger community that benefits from this so we might as well give something back.

So now that you understand a few of the risks associated with using visual studio code extensions lets just dive into the usefulness of them and how each helps you on your day to day tasks.


If I had to say there’s only one visual studio code extension that you should use for Python, I think Pylance would be the answer. It’s the alpha and the omega for writing Python code in Visual studio code. Below you would find some of the features it offers directly from the plugin page.

  • Docstrings
  • Signature help, with type information
  • Parameter suggestions
  • Code completion
  • Auto-imports (as well as add and remove import code actions)
  • As-you-type reporting of code errors and warnings (diagnostics)
  • Code outline
  • Code navigation
  • Type checking mode
  • Native multi-root workspace support
  • IntelliCode compatibility
  • Jupyter Notebooks compatibility
  • Semantic highlighting

My personal favorite is the code completion (who doesn’t like fast class expansion and naming lookup?) and offcourse the automatic error checking. It has helped me save countless hours of coding time by identifying problems for me as I code which would have ended up being runtime errors otherwise. Another thing I really enjoy is the syntax highlighting, that along with some other extensions that I will talk about later makes code readability easier. Overall it’s a great extension and it’s developed by Microsoft if that makes you feel more or less comfortable using it, it’s a different story. Just remember Microsoft also develops the editor itself!

Visual Studio Code - Pylance error detection
Visual Studio Code – Pylance error detection

If you would like to find more about this extension you can visit their page here.

Python Docstring Generator

While Pylance is great and has some good support for docstrings I believe it doesn’t do a great job as Python Docstring Generator. I have to admit I absolutely love this extension because I’m generally lazy when it comes to documentating my functions. When I’m writing code I’m always in a rush to test the next big thing, debug it and see if it works. As developers we naturally have an inclination that documenting the work we did is more of monkey work and want to avoid it at all costs. Up to date I haven’t met a single developer that likes to document his functions if you are one of them please drop me a line below! So I believe having something that automatically does this for you is a great option. Take for example the code below the entire template of the function was generated by Python Docstring Generator I didn’t have to do anything. I left the default values as-is so you can see the little stuff you need to manually fill in afterwards.

def print_name(first_name: str, last_name: str, age: int) -> str:

        first_name (str): [description]
        last_name (str): [description]
        age (int): [description]

        str: [description]
    return 'I am %s %s and my age is: %d'%(first_name, last_name, age)

As you can see above the docstring extension picked up everything accurately all you have to do is put in the descriptions and you are set (the plugin still can’t read minds maybe in the future if AI improves it would be a great addition to it!). Now tell me if this is worth it and if it’s a time saver.

If you would like to find more about this extension you can visit their page here.

Rainbow brackets

Rainbow brackets is a plugin that visualizes your life when it comes to having multiple parenthesis in your code. I can’t stress enough how much time this has saved me when I’m reading someone else’s code (I personally don’t like to cascade multiple parenthesis unless I need too). It follows a coloring scheme that lets you discern the opening and closing of a bracket. The simple concept of using color pairs for this is very poweful because at a simple glance you can tell where your statement started and ended.

Visual Studio Code - Rainbow brackets
Visual Studio Code – Rainbow brackets

If you would like to find more about this extension you can visit their page here.

Rainbow indent

Rainbow indent similar to rainbow brackets is an extension that colorizes the tab level you are in. These days in visual studio code this may not be much of an issue but if you are reading a massive code block that spans multiple pages the difficulty and readability of that code may be challenging and require scrolling up and down a few times until you find what you want, which is the beginning of the code block. Yes I know there’s the expand/collapse part in Visual Studio Code but it’s different to be able read the code and keep things collapsed. I personally prefer for example being able to read the code and checking where the problem could be if I’m debugging something.

Visual Studio Code - Rainbow indent
Visual Studio Code – Rainbow indent

If you would like to find more about this extension you can visit their page here.


Gitlens is a useful extension that adds some capabilities on pairing your Python code with Git source control. If you are not using git in your projects then you can skip over this extension for now, but I personally use GIT pretty much on everything I write code for. The time for SVN is long past for me. Anyway here’s a list of features that gitlens offers:

  • Effortless navigation of revision history
  • Authorship in lines of code
  • Status bar GIT blame
  • Commit view in a visual way
  • Line history view in a visual way
  • Stashes view
  • Repository listing view
  • Tags view
  • Search and compare view of files

My favorite one is the visual file comparison along with being able to see who wrote what code. If you are in the management field you will know by now that being able to quickly scan between pull requests and then diving into the code history is vital. These things eventually become second nature for you and this is where Gitlens comes in to make your life easier. It offers all those out of the box functionality and hands it in a platter for you without having to do any work.

Visual Studio Code - Gitlens GIT information
Visual Studio Code – Gitlens GIT information

If you would like to find more about this extension you can visit their page here.

Debugger for AWS Lambda

If you are using AWS lambda with Python (or nodejs) this plugin is particularly useful. It lets you remotely debug the AWS lambda code directly from within Visual Studio Code. If you pair it with AWS toolkit then you can quickly launch and test your code with never leaving the editor. For me this is a huge plus as I use AWS Lambda functions on a regular basis and sometimes I like to be able to have the control of investigating variables, inspecting the calling stack etc. However the biggest advantage for me is not having to connect to the console and go through various clicks then return back to my editor to do a change and re-deploy my code, in terms of time saving that’s a big plus. Of course if you are not using AWS lambdas this plugin may not be very useful for you but if you do, I personally can’t live without it and I’m not willing to go back to using the old way of debugging things.

If you would like to find more about this extension you can visit their page here.


My personal favorite Visual Studio Code extension is Pylance and I don’t think you can blame me for thinking so. It offers such a powerful kit that makes your life so much easier if you are Python developer. All the features are rich and very stable. Since it was released I’ve been a big fan of it and replaced the old Python visual studio code extension and never went back to it. Extensions are very much a matter of personal taste so I’m sure some of them may not be needed for you, I just tried to list the ones I’ve been using the last few years and have been truly beneficial to me. If you found the 6 Visual code extensions to improve your python code useful please drop be a cheer below I would appreciate it.

If you have any questions, comments below I check periodically and try to answer them in the priority they come in.
Also if you have any corrections please do let me know and I’ll update the article with new updates or mistakes I did.

If you would like to learn more about Python please take a look at my section here for more articles.

Which Visual Studio Code extension you find useful?

6 Visual code extensions to improve your python code
6 Visual code extensions to improve your python code

Leave a Comment

Your email address will not be published. Required fields are marked *