Skip to content

Pylint

Pylint is a static code analysis tool (linter) for Python that detects issues, enforces conventions, and offers refactoring guidance.

Installation and Setup

Install it from the Python Package Index (PyPI) into a virtual environment:

Language: Windows PowerShell
(venv) PS> py -m pip install pylint
(venv) PS> py -m pylint --version
Language: Shell
(venv) $ python -m pip install pylint
(venv) $ python -m pylint --version

Configuration can live in pyproject.toml or a .pylintrc file at the project root. You can bootstrap a configuration file with:

Language: Shell
$ python -m pylint --generate-rcfile > .pylintrc

Key Features

  • Detects programming errors, such as undefined names, unused variables, import issues, and unreachable code.
  • Checks coding style and naming conventions and can be tuned to match project guidelines.
  • Provides refactoring hints and code smell warnings, along with a summary report and score.
  • Is highly configurable with per-project, per-file, and per-line control of messages and rules.
  • Integrates with editors and continuous integration (CI) systems through standard command-line usage and exit codes.

Usage

Analyze a module, package, or file path:

Language: Shell
$ python -m pylint path/to/package

Limit output to errors only:

Language: Shell
$ python -m pylint --errors-only path/to/file.py

Enable or disable specific checks on the command line:

Language: Shell
$ python -m pylint -d C0114 -e E0602 module_name.py

Silence a check inline for a single line or block:

Language: Python
# pylint: disable=unused-argument
def greet(name):
    print("Hello")

Generate a summary report for a package:

Language: Shell
$ python -m pylint --reports=y package/

Course

Writing Cleaner Python Code With PyLint

In this video series you'll see how to install and set up the PyLint code linter tool. You'll learn why you should use code linters like PyLint, Flake8, PyFlakes, or other static analysis tools—and how they can help you write cleaner and more Pythonic code.

intermediate tools

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated May 28, 2026