talira

A thorough static code analyser for Python that infers values instead of trusting type hints

open sourceGPL-2.0-or-laterfree

Pylint is a static code analyser for Python: it checks code without running it for errors, coding standard violations and code smells, and suggests refactorings. It infers the actual values of names through its own code model (astroid) rather than trusting type hints, which makes it slower than other linters but lets it find more problems in code that isn't fully typed. It has more checks than most linters, some opinionated ones off by default, is highly configurable, and takes plugins for frameworks and libraries (pylint-django, pylint-pydantic). It ships two more tools, pyreverse (package and class diagrams) and symilar (a duplicate code finder), and runs in most editors, including through Microsoft's VS Code extension. GPL-2.0-or-later.

Problems it solves

  • catch bugs in my Python code before I run it
  • enforce a coding standard across a Python team's code
  • find code smells and refactoring opportunities in a legacy Python project

Features

  • error detection, coding standard checks and code smells
  • refactoring suggestions
  • value inference through astroid, beyond type hints
  • configurable checks and severities
  • plugins for frameworks and libraries
  • pyreverse diagrams and symilar duplicate-code finder

Limitations

  • Slower than other linters because of its inference1
  • Third-party libraries may need a plugin to be checked correctly1
  • The latest version supports Python 3.11.0 and above1

Alternatives

The same job

These do what Pylint does.

  1. Ruff An extremely fast Python linter and code formatter, written in Rust
  2. golangci-lint Fast linters runner for Go

Compare Pylint with the top 3