Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Using PyLint: Recap and Summary

Give Feedback

Congratualations, you’ve made it until the end! This is the last video of the course and provides you a little summary of what you’ve learned during the course. Furthermore, a few recommondations are given.

00:00 In summary, this is how you use Pylint. You just pip install it and you can fire away. It’s a command line tool, so that means you can run it on your tests, you can run it as part of a build script, or you can run that in any way you like. And it is a great tool.

00:15 It’s going to give you a lot of valuable feedback on your Python code. There are other tools just like it. In general, these tools are called static analysis tools.

00:24 And I would highly recommend that you start learning about these tools and start using these tools because they can give you a lot of valuable feedback on your Python code. Actually, I just noticed something. So here, I’m not sure why this wasn’t called out, but did you see that? I had some extra spaces here.

00:42 I’m not sure why Pylint didn’t call that out, because it looked like it would actually violate the coding guidelines here, the code style guidelines. So anyway, you know, I guess that’s also an example that shows you that these tools are not perfect, right? That’s what I mean. Like, now we’ve got supposedly perfect code quality, but of course we’ve got to take that with a grain of salt because, I mean, it’s not… Like, this is actually a useless program, right?

01:08 This doesn’t really do anything interesting. So, I just wanted to mention that again. Because it’s very easy to kind of go that route where it’s like, “Oh yeah!

01:15 We just need to make all the metrics go up and then we’ll write the perfect programs! We’ll be that much more productive.” Generally, that’s not true. Nevertheless, please use these tools. Like, you can’t see this, but right now I’m doing the double thumbs up here in front of my computer as I’m recording this because they are great. Try and integrate them into your editing environment.

01:35 Whether you’re using PyCharm or Sublime or Atom or Vim or Emacs—they all have tools and plugins that allow you to get this feedback straight in your editor, and it is very, very useful. It’s very, very helpful.

01:49 I’ve disabled that for this video here in my editor, because I wanted to show you kind of the bare-bones manual approach with the command line. But in general, I would encourage you to actually pull that feedback into your IDE or your Python editor. All right! Well, I hope this was useful, so happy Pythoning and I’ll talk to you soon. Cheers!

Vasanth T on May 14, 2019

Very useful tool and thanks Dan for putting this in a simple video format. Now I will look for the sublime text plugin for this....

Dan Bader RP Team on May 14, 2019

Thanks! Check out SublimeLinter :)

Prerit Anwekar on May 15, 2019

Thanks Dan! I do like linters but as you said, the tools are not perfect and somethings have more subjective answers. Oh and I bought the Python tricks book too…it’s really cool!! :D Thank you!

The Cool Ghoul on July 27, 2019

I use the anaconda navigator and jupyter as my IDE. Anaconda also offers sypder as a Python IDE along with Jupyter. For those using Jupyter, which I still love, Spyder is a very nice complement to it. From time to time, export your notebook file as a python program ( .py) file. Then import into Spyder. Spyder can use pylint for static code analysis. You may need to install pylint via conda via the command line: conda install -c anaconda pylint

Ghani on Oct. 26, 2020

Nice course; thanks!

Ricc on Oct. 1, 2021

Congrats!

What plugin you suggest to Atom?

Ivanhoe on May 17, 2022

Thanks for an interesting course Dan. I was wondering how one would go about using pylint on an entire python package. So say I have the following structure: /main.py, /src, /src/module1, /src/module2, /src/module3, /tests, /tests/module1, /tests/module2, /tests/module3, /doc

In main.py I import all the needed modules. Is there a way to use pylint on main.py so that it checks all the underlying modules which may contain various classes and functions.

Dan Bader RP Team on May 20, 2022

Is there a way to use pylint on main.py so that it checks all the underlying modules which may contain various classes and functions?

Great question! Depending on the project layout, it can be a bit tricky to get pylint to check all Python source files.

If your subfolders contain __init__.py files that designate them as Python packages you should be able to run pylint ./<your-toplevel-package> and pylint will lint everything in that package.

Alternatively, you can use a shell command to gather all .py source files and then pass that list to pylint. Assuming you’re on Linux/macOS, something like this would do the trick:

find . -type f -name "*.py" | xargs pylint 

I see your example folder structure included “test” folders. If you’re already using pytest to run your tests, then check out the pytest-pylint plugin. It will lint your Python files with pylint as part of a test run. That’s probably the most convenient option.

Hope this helps you out. You can get more info here in this Stack Overflow discussion

Become a Member to join the conversation.