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:
Configuration can live in pyproject.toml or a .pylintrc file at the project root. You can bootstrap a configuration file with:
$ 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:
$ python -m pylint path/to/package
Limit output to errors only:
$ python -m pylint --errors-only path/to/file.py
Enable or disable specific checks on the command line:
$ python -m pylint -d C0114 -e E0602 module_name.py
Silence a check inline for a single line or block:
# pylint: disable=unused-argument
def greet(name):
print("Hello")
Generate a summary report for a package:
$ python -m pylint --reports=y package/
Related Resources
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.
For additional information on related topics, take a look at the following resources:
By Leodanis Pozo Ramos • Updated May 28, 2026