•  

12 years of Pylint - an overview of the most comprehensive static analysis tool for Python

A session at PyCon Ireland 2015

Sunday 25th October, 2015

4:00pm to 5:00pm (DMT)

"Given the dynamic nature of Python, some bugs tend to creep in our codebases. Innocents NameError or hard-to-find bugs with variables used in a closure, but defined in a loop, they all stand no chance in front of Pylint (http://pylint.org/).

In this talk, I’ll present one of the oldest static analysis tools for Python, with emphasis on what it can do to understand your Python code. Pylint is both a style checker, enforcing PEP 8 rules, as well as a code checker in the vein of pyflakes and pychecker, but its true power isn’t always obvious in the eye of beholder, especially when it's hidden through its verbosity. Interpreting its results can be a daunting task, but there are tricks which can be used to improve its user experience, such as enabling only structural checking with the -E flag or disabling unwanted category checks.

Pylint can detect simple bugs such as unused variables and imports, but it can also detect more complicated cases such as invalid arguments passed to functions, it understands the method resolution order of your classes, generators, contexts managers and what special methods aren’t implemented correctly.

Starting from abstract syntax trees, we’ll go through its inference engine and we’ll see how Pylint understands the logical flow of your program and what sort of type hinting techniques are used to improve its inference, including PEP 484 type hints. Pylint's roadmap includes better understanding of Python code, by improving its flow control analysis, escape analysis, understanding metaclasses and descriptors and having a better type checker, as well as improving the user experience, by reducing the number of false positives it currently has. As a bonus, I’ll show how it can be used to help you port your long-forgotten library to Python 3, using its new –py3k mode, which emits warnings regarding Python 3 compatibility.

The talk will contain the following aspects:

  • Why doing static analysis for Python, how does it help us as programmers.
  • A little bit about other tools, such as pep8, flake8, pyflakes, pychecker, mypy and how Pylint is different than them and how it cooperates with them.
  • General Pylint architecture: abstract syntax trees, API transform of the tree, inference engine, control flow understanding and partial abstract interpretation.
  • Useful pylint extensions, Python 3 porting mode, docstring validator, pyreverse for building diagrams from your project etc"

About the speaker

This person is speaking at this event.
Claudiu Popa

PyLint maintainer

I'm an open source enthusiast coming from Romania. Lead maintainer of the Pylint project and on my way to becoming a CPython core contributor someday, I'm also interested in language design, interpreters, static analysis and how languages work under the hood, as well as in building a community around a technology, being the founder of the biggest romanian Python group, RoPython.

Next session in Goldsmith 1 + 2

5pm Data analysis and visualisation in Python by Grazia D’Aversa

6 attendees

  • Aleksandar Topuzovic
  • Tim Kersten
  • Nicolas Laurance
  • Claudiu Popa
  • Sorcha (Nic Amhalaí) Bowler
  • Keith Gaughan

1 tracker

  • Niall Glynn

Sign in to add slides, notes or videos to this session

Sign in to track this session

PyCon Ireland 2015

Ireland Ireland, Dublin

24th25th October 2015

Tell your friends!

When

Time 4:00pm5:00pm DMT

Date Sun 25th October 2015

Where

Goldsmith 1 + 2, Radisson Blu Royal Hotel

Short URL

lanyrd.com/sdrtzg

Official event site

python.ie/pycon

View the schedule

Share

See something wrong?

Report an issue with this session