Linters: pep8 vs Pylint

python

#1

My manager wants to learn more about coding in Python, so I am trying to give her advice and tips. I think she would benefit from learning how to use a linter. Just for background, she works in Visual Studio Code on Windows 10. I usually use pylint, which I believe is the default for that particular IDE. However, she has heard about another linter caller pep8 (http://pep8.readthedocs.io/en/release-1.7.x/).

Does anyone know what is the difference between pylint and pep8? Would using both be overkill?

Thanks.


#2

PEP8 is usual community coding standard in Python-land. pylint is a linter that applies standards – usually, but not necessarily pep8.

There seems to be an alternate linter, confusiingly called pep8.

Since pylint is will apply the standard (PEP8) you get the same standard for free. pylint is pretty mature and popular, I’d go with that.


#3

We use pylint at work, though we don’t strictly follow pep8.

At home I use auto-pep8 in sublime so that I don’t need to think all that hard.

Just to throw more confusion, flake8 is yet another linter.


#4

Generally any linter is great for code consistency and style points; the stuff that they catch beyond that is a double-edged sword for n00bs because it will help sometimes and other times add confusing verbiage to what’s already an unfamiliar problem.

You might just try starting her on PyCharm


#5

Yeah, it looks like the linter is swappable in the vscode extension.
Also the linter is a separate install.

But I agree with @Theodox the linters are pretty interchangeable for simple style checking.

One quick question, how much programming experience does she have? Is this an exercise in learning python the language, or learning to code in python? Because if this is the latter, a full blown linter could be rather overwhelming.


#6

I thought pep8 (the module, not the style guide) was not a true linter. It only enforces the PEP8 formatting style. Pylint can do that and also normal linter operations such as finding unused variables, missing / unused imports, etc… Additionally Pylints style checker can be modified to support whatever coding style you may use. Pep8 (the tool) can only enforce PEP8 (the standard)


#7

pep8 can be told to ignore certain elements, say the 80 character line limit of annoyance.
But yes, pep8 is designed only for checking style, in fact flake8 uses for just that purpose, it uses pyflakes for the rest of its linting capabilities.


#8

She does have some coding experience. She is a FileMaker guru, and apparently, FileMaker does have a scripting language. She knows the basics (variables, loops, etc.). She doesn’t know what a class is, but she does not need to at this point.

Getting a decent IDE that she can wrap her head around has been a big help because she knows what a debugger is. I first tried Eclipse, but that was too complicated. That’s fair. I like Eclipse, but sometimes doing something basic (like updating Eclipse) is a real pain. She likes Visual Studio Code, so that has worked out. I started using VS Code too.

I probably should be doing code reviews, but I haven’t found the time yet. Plus, I’m not sure how well that would work. She is my manager. Can I just tell her to go back and fix something?


#9

You might find PyCharm a good fit too, since it’s very Python-specific and teaches good habits with the style suggestions