Sourcery | IDE Plugin for Python to Improve Code Quality | PyCharm Plugin

Do you want to improve your Python code quality? Then you can check a new plugin that is sourcery.

Sourcery provides you a facility to improve python code quality in just a few clicks, you can use this plugin in your PyCharm or VSCode and it will take your coding experience to the next level.

The most important benefit to add sourcery into your IDE is that your coding knowledge will increase by using this plugin regularly and, It will give you the best suggestion to improve the python code quality and also helped you to write python code cleaner.

In this article I will show you steps to set up sourcery in PyCharm, so let’s start it.

Steps to setup sourcery in PyCharm:

1. First click here to sign up for the sourcery account.

2. Click on “Add to PyCharm”

3. Click on “Sign Up with Google”, use any account to sign up.

4. Now click on Continue. (Note:- Sourcery provide access to Pro Features for 30 days)

5. Now on the next page you can tell about yourself to sourcery if you want or you can skip this step.

6. Now you will reach the dashboard, from here you can copy your token (check-in below image) that we will use further to set up sourcery in PyCharm.

7. Now open PyCharm then click on a file then settings and finally click on plugins to open the Marketplace tab inside plugins, check the below image for reference.

8. Now search sourcery here and install sourcery plugin.

9. After installation is complete click on “Restart IDE”.

10. After Restart PyCharm, again open settings and now you will see an option sourcery, click on that and paste the token (that we get in step 6) inside Sourcery Token option.

11. Finally click on the “OK” button, now you are ready to use sourcery in your PyCharm.

Let’s start writing the code and check how sourcery works, to improve python code quality.

So write the below code first in your PyCharm.

Sample Code:

my_list = []
for i in range(5):

Now after writing this code, you can see on the top, my_list is highlighting, just hover over on my_list and see sourcery is giving us the suggestion “Convert for loop into list comprehension” just click on it.

Code Output after use Sourcery:

my_list = [i for i in range(5)]

Now you can see our previous code is converted into new code here, and you can see it is now cleaner and of good quality as compare to before.

So in this way you can use sourcery to improve your python code quality and make it cleaner using sourcery smart refractors and suggestions.

You can also watch our this video, In this video, I explained everything about sourcery and how to use it in our IDE.

Check out top 5 IDE for Python Developers in 2021

1 thought on “Sourcery | IDE Plugin for Python to Improve Code Quality | PyCharm Plugin”

  1. Pingback: Top 5 IDE for Python Developers in 2021 - ProgrammingFever

Comments are closed.

Shopping Cart