# Python linter libraries

Python linter libraries read source code without running it and report errors, style violations, and suspicious patterns. A linter parses each file into a syntax tree and checks it against a set of rules. These libraries let developers and AI coding agents catch mistakes before code review.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Ruff](#ruff) | 432.1M | 51.3K | Nov 2026 | MIT |
| [pycodestyle](#pycodestyle) | 63.2M | 5.2K | Sep 2026 | MIT |
| [Pyflakes](#pyflakes) | 53.8M | 1.5K | Oct 2026 | MIT |
| [Flake8](#flake) | 43.3M | 3.8K | Oct 2026 | MIT |
| [Pylint](#pylint) | 40.8M | 5.8K | Nov 2026 | GPL-2.0-or-later |
| [pydocstyle](#pydocstyle) | 4.4M | 1.1K | Jan 2023 | MIT |
| [Prospector](#prospector) | 325.9K | 2.1K | Nov 2026 | GPL-2.0-or-later |
| [Pylama](#pylama) | 98.3K | 1.0K | Aug 2022 | MIT |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[Ruff](#ruff) has the most monthly downloads in this comparison, at 432.1M.

## Capabilities

| Library | Automatic fixes | Docstring checks | JSON reports |
| --- | --- | --- | --- |
| [Ruff](#ruff) | Yes | Yes | Yes |
| [pycodestyle](#pycodestyle) | No | No | No |
| [Pyflakes](#pyflakes) | No | No | No |
| [Flake8](#flake) | No | Via plugin | Via plugin |
| [Pylint](#pylint) | No | Yes | Yes |
| [pydocstyle](#pydocstyle) | No | Yes | No |
| [Prospector](#prospector) | No | Yes | Yes |
| [Pylama](#pylama) | No | Yes | Yes |

## Libraries

### Ruff

[GitHub](https://github.com/astral-sh/ruff) · [PyPI](https://pypi.org/project/ruff) · [Docs](https://docs.astral.sh/ruff/)

Lints Python files and directories with optional automatic fixes.

- Downloads / mo: 432.1M
- Stars: 51.3K
- Last release: 0.17.6
- License: MIT
- Capabilities: [From the Ruff docs](https://docs.astral.sh/ruff/)

**Strengths**

- **Applies safe fixes by default.** Use check --fix to apply available safe changes.
- **Rechecks files as they change.** Use check --watch for continuous directory linting.

**Watch out for**

- **Custom rules need another tool.** Choose Flake8 when adding project-specific Python checks.
- **Unsafe fixes can change behavior.** Review unsafe changes before enabling --unsafe-fixes.

```sh
python -m pip install ruff==0.17.6
```

**Quickstart**

```python
ruff check .

```

From [linter.md](https://github.com/astral-sh/ruff/blob/0.17.6/docs/linter.md) · [Find projects using Ruff →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20ruff%20native%20diagnostic%20checks%20custom%20reporters%20source%20linting&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### pycodestyle

[GitHub](https://github.com/PyCQA/pycodestyle) · [PyPI](https://pypi.org/project/pycodestyle) · [Docs](https://pypi.org/pypi/pycodestyle/json)

Checks Python code against a subset of PEP 8 style conventions.

- Downloads / mo: 63.2M
- Stars: 5.2K
- Last release: 2.15.0
- License: MIT
- Capabilities: [From the pycodestyle docs](https://pypi.org/pypi/pycodestyle/json)

**Strengths**

- **Needs only the standard library.** Embed its single Python module for style checking.
- **Accepts custom style checks.** Register additional checks through its plugin architecture.

**Watch out for**

- **Style coverage is deliberately partial.** Some PEP 8 rules are outside its scope.
- **Leaves automatic fixes to others.** Use a separate fixer to change source code.

```sh
python -m pip install pycodestyle==2.15.0
```

**klen/pylama** (1.0K stars)

[klen/pylama](https://github.com/klen/pylama) 

```python
def run_check(self, ctx: RunContext):  # noqa
    """Check code with pycodestyle."""
    params = ctx.get_params("pycodestyle")
    options = ctx.options
    if options:
        params.setdefault("max_line_length", options.max_line_length)

    if params:
        parser = get_parser()
        for option in parser.option_list:
            if option.dest and option.dest in params:
                value = params[option.dest]
                if isinstance(value, str):
                    params[option.dest] = option.convert_value(option, value)

    style = StyleGuide(reporter=_PycodestyleReport, **params)
    options = style.options
    options.report.ctx = ctx  # type: ignore
    checker = Checker(ctx.filename, lines=ctx.lines, options=options)
    checker.check_all()

```

[pylama/lint/pylama_pycodestyle.py](https://github.com/klen/pylama/blob/53ad214de0aa9534e59bcd5f97d9d723d16cfdb8/pylama/lint/pylama_pycodestyle.py#L13-L32) · [More projects using pycodestyle →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20pycodestyle%20native%20diagnostic%20checks%20custom%20reporters%20source%20linting&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
pycodestyle .

```

From [advanced.rst](https://pycodestyle.pycqa.org/en/latest/intro.html)

### Pyflakes

[GitHub](https://github.com/PyCQA/pyflakes) · [PyPI](https://pypi.org/project/pyflakes) · [Docs](https://pypi.org/pypi/pyflakes/json)

Checks Python programs without running them.

- Downloads / mo: 53.8M
- Stars: 1.5K
- Last release: 4.1.0
- License: MIT
- Capabilities: [From the Pyflakes docs](https://pypi.org/pypi/pyflakes/json)

```sh
python -m pip install pyflakes==4.1.0
```

**klen/pylama** (1.0K stars)

[klen/pylama](https://github.com/klen/pylama) 

```python
def run_check(self, context: RunContext):  # noqa
    """Check code with pyflakes."""
    params = context.get_params("pyflakes")
    builtins = params.get("builtins", "")
    if builtins:
        builtins = builtins.split(",")

    check = checker.Checker(context.ast, context.filename, builtins=builtins)
    for msg in check.messages:
        context.push(
            lnum=msg.lineno,
            col=msg.col + 1,
            text=msg.message % msg.message_args,
            number=CODES.get(msg.message, ""),
            source="pyflakes",
        )

```

[pylama/lint/pylama_pyflakes.py](https://github.com/klen/pylama/blob/53ad214de0aa9534e59bcd5f97d9d723d16cfdb8/pylama/lint/pylama_pyflakes.py#L38-L53) · [More projects using Pyflakes →](https://dashboard.exa.ai/playground/search?q=pyflakes%20GitHub%20projects)

**Quickstart**

```python
pyflakes .

```

From [api.py](https://github.com/PyCQA/pyflakes/blob/4.1.0/pyflakes/api.py)

### Flake8

[GitHub](https://github.com/PyCQA/flake8) · [PyPI](https://pypi.org/project/flake8) · [Docs](https://pypi.org/pypi/flake8/json)

Combines PyFlakes, pycodestyle, and McCabe checks in one per-file warning stream.

- Downloads / mo: 43.3M
- Stars: 3.8K
- Last release: 7.5.0
- License: MIT
- Capabilities: [From the Flake8 docs](https://pypi.org/pypi/flake8/json)

**Strengths**

- **Combines error and style checks.** Run PyFlakes, pycodestyle, and complexity checks through one command.
- **Loads custom checkers and formatters.** Extend diagnostics through extension and formatting entry points.

**Watch out for**

- **Python API has compatibility gaps.** The legacy API does not preserve every argument or required type.

```sh
python -m pip install flake8==7.5.0
```

**python-lsp/python-lsp-server** (2.6K stars)

[python-lsp/python-lsp-server](https://github.com/python-lsp/python-lsp-server) 

```python
def run_flake8(flake8_executable, args, document, source):
    """Run flake8 with the provided arguments, logs errors
    from stderr if any.
    """
    # a quick temporary fix to deal with Atom
    args = [
        (i if not i.startswith("--ignore=") else FIX_IGNORES_RE.sub("", i))
        for i in args
        if i is not None
    ]

    if document.path and document.path.startswith(document._workspace.root_path):
        args.extend(
            [
                "--stdin-display-name",
                os.path.relpath(document.path, document._workspace.root_path),
            ]
        )

    # if executable looks like a path resolve it
    if not os.path.isfile(flake8_executable) and os.sep in flake8_executable:
        flake8_executable = os.path.abspath(
            os.path.expanduser(os.path.expandvars(flake8_executable))
        )

    log.debug("Calling %s with args: '%s'", flake8_executable, args)
    popen_kwargs = {"creationflags": CREATE_NO_WINDOW}
    if cwd := document._workspace.root_path:
        popen_kwargs["cwd"] = cwd
    try:
        cmd = [flake8_executable]
        cmd.extend(args)
        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, **popen_kwargs)
    except OSError:
        log.debug(
            "Can't execute %s. Trying with '%s -m flake8'",
            flake8_executable,
            sys.executable,
        )
        cmd = [sys.executable, "-m", "flake8"]
        cmd.extend(args)
        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, **popen_kwargs)
    (stdout, stderr) = p.communicate(source.encode())
    if stderr:
        log.error("Error while running flake8 '%s'", stderr.decode())
    return stdout.decode()

```

[pylsp/plugins/flake8_lint.py](https://github.com/python-lsp/python-lsp-server/blob/a3620069a607a63ed52569fde188e9301feae93a/pylsp/plugins/flake8_lint.py#L112-L157) · [More projects using Flake8 →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20flake8%20native%20diagnostic%20checks%20custom%20reporters%20source%20linting&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
flake8 .

```

From [configuration.rst](https://github.com/PyCQA/flake8/blob/1c7fec1973ed3a7c192dbe1e96906fbbd1dbe49e/docs/source/user/invocation.rst)

### Pylint

[GitHub](https://github.com/pylint-dev/pylint) · [PyPI](https://pypi.org/project/pylint) · [Docs](https://pypi.org/pypi/pylint/4.1.4/json)

Checks errors, coding conventions, and refactoring opportunities without running the target code.

- Downloads / mo: 40.8M
- Stars: 5.8K
- Last release: 4.1.4
- License: GPL-2.0-or-later
- Capabilities: [From the Pylint docs](https://pypi.org/pypi/pylint/4.1.4/json)

**Strengths**

- **Infers values behind variable names.** Finds issues in code that is not fully typed.
- **Captures reports in custom streams.** Pass a reporter with an open stream to Run.

**Watch out for**

- **Full checks slow live feedback.** Run full checks on save or in CI instead of each keystroke.
- **Third-party support is incomplete.** Load a checker plugin for unsupported framework behavior.

```sh
python -m pip install pylint==4.1.4
```

**klen/pylama** (1.0K stars)

[klen/pylama](https://github.com/klen/pylama) 

```python
def run_check(self, ctx: RunContext):
    """Pylint code checking."""
    logger.debug("Start pylint")
    params = ctx.get_params("pylint")
    options = ctx.options
    if options:
        params.setdefault("max_line_length", options.max_line_length)
        params.setdefault("confidence", options.pylint_confidence)

    params.setdefault("enable", ctx.select | ctx.get_filter("pylint", "select"))
    params.setdefault("disable", ctx.ignore | ctx.get_filter("pylint", "ignore"))
    # if params.get("disable"):
    #     params["disable"].add("W0012")

    class Reporter(BaseReporter):
        """Handle messages."""

        def _display(self, _):
            pass

        def handle_message(self, msg):
            msg_id = msg.msg_id
            ctx.push(
                filtrate=False,
                col=msg.column + 1,
                lnum=msg.line,
                number=msg_id,
                text=msg.msg,
                type=msg_id[0],
                source="pylint",
            )

    logger.debug(params)

    reporter = Reporter()
    args = _Params(params).to_attrs()
    Run([ctx.temp_filename] + args, reporter=reporter, exit=False)

```

[pylama/lint/pylama_pylint.py](https://github.com/klen/pylama/blob/53ad214de0aa9534e59bcd5f97d9d723d16cfdb8/pylama/lint/pylama_pylint.py#L35-L71) · [More projects using Pylint →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20pylint%20native%20diagnostic%20checks%20custom%20reporters%20source%20linting&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
pylint --recursive=y .

```

From [pylint.rst](https://github.com/pylint-dev/pylint/blob/edc8e376ba4affd43bc07571bdf3a90efc281ba7/doc/user_guide/usage/run.rst)

### pydocstyle

[GitHub](https://github.com/PyCQA/pydocstyle) · [PyPI](https://pypi.org/project/pydocstyle) · [Docs](https://www.pydocstyle.org/en/stable/)

Checks docstring style.

- Downloads / mo: 4.4M
- Stars: 1.1K
- Last release: 6.3.0
- License: MIT
- Capabilities: [From the pydocstyle docs](https://www.pydocstyle.org/en/stable/)

```sh
python -m pip install pydocstyle==6.3.0
```

**klen/pylama** (1.0K stars)

[klen/pylama](https://github.com/klen/pylama) 

```python
def run_check(self, ctx: RunContext):  # noqa
    """Check code with pydocstyle."""
    params = ctx.get_params("pydocstyle")
    options = ctx.options
    if options and options.pydocstyle_convention:
        params.setdefault("convention", options.pydocstyle_convention)
    convention_codes = conventions.get(params.get("convention"))
    for err in PyDocChecker().check_source(
        ctx.source,
        ctx.filename,
        params.get("ignore_decorators"),
        params.get("ignore_inline_noqa", False),
    ):
        if convention_codes is None or err.code in convention_codes:
            ctx.push(
                lnum=err.line,
                text=err.short_desc,
                type="D",
                number=err.code,
                source="pydocstyle",
            )

```

[pylama/lint/pylama_pydocstyle.py](https://github.com/klen/pylama/blob/53ad214de0aa9534e59bcd5f97d9d723d16cfdb8/pylama/lint/pylama_pydocstyle.py#L26-L46) · [More projects using pydocstyle →](https://dashboard.exa.ai/playground/search?q=pydocstyle%20GitHub%20projects)

**Quickstart**

```python
pydocstyle .

```

From [README.rst](https://pypi.org/pypi/pydocstyle/json)

### Prospector

[GitHub](https://github.com/prospector-dev/prospector) · [PyPI](https://pypi.org/project/prospector) · [Docs](https://pypi.org/pypi/prospector/json)

Analyzes Python code by combining the results of other tools.

- Downloads / mo: 325.9K
- Stars: 2.1K
- Last release: 1.20.1
- License: GPL-2.0-or-later
- Capabilities: [From the Prospector docs](https://pypi.org/pypi/prospector/json)

```sh
python -m pip install prospector==1.20.1
```

**DonJayamanne/pythonVSCode** (2.1K stars)

[DonJayamanne/pythonVSCode](https://github.com/DonJayamanne/pythonVSCode) 

```python
def main():
    invoke = sys.argv[1]
    if invoke == "-m":
        linter = sys.argv[2]
        args = [sys.executable, "-m", linter] + linter_settings[linter]["args"] + sys.argv[3:]
    else:
        linter = sys.argv[2]
        args = [sys.argv[3]] + linter_settings[linter]["args"] + sys.argv[4:]

    if hasattr(subprocess, "run"):
        subprocess.run(args, encoding="utf-8", stdout=sys.stdout, stderr=sys.stderr)
    else:
        subprocess.call(args, stdout=sys.stdout, stderr=sys.stderr)

```

[python_files/linter.py](https://github.com/DonJayamanne/pythonVSCode/blob/01c3f16217a5777476e59fe8bd7fdb2bc87f26b6/python_files/linter.py#L36-L48) · [More projects using Prospector →](https://dashboard.exa.ai/playground/search?q=prospector%20GitHub%20projects)

**Quickstart**

```python
prospector .

```

From [usage.rst](https://prospector.landscape.io/en/master/usage.html)

### Pylama

[GitHub](https://github.com/klen/pylama) · [PyPI](https://pypi.org/project/pylama) · [Docs](https://klen.github.io/pylama)

Audits Python code.

- Downloads / mo: 98.3K
- Stars: 1.0K
- Last release: 8.4.1
- License: MIT
- Capabilities: [From the Pylama docs](https://klen.github.io/pylama)

```sh
python -m pip install pylama==8.4.1
```

**DonJayamanne/pythonVSCode** (2.1K stars)

[DonJayamanne/pythonVSCode](https://github.com/DonJayamanne/pythonVSCode) 

```python
def main():
    invoke = sys.argv[1]
    if invoke == "-m":
        linter = sys.argv[2]
        args = [sys.executable, "-m", linter] + linter_settings[linter]["args"] + sys.argv[3:]
    else:
        linter = sys.argv[2]
        args = [sys.argv[3]] + linter_settings[linter]["args"] + sys.argv[4:]

    if hasattr(subprocess, "run"):
        subprocess.run(args, encoding="utf-8", stdout=sys.stdout, stderr=sys.stderr)
    else:
        subprocess.call(args, stdout=sys.stdout, stderr=sys.stderr)

```

[python_files/linter.py](https://github.com/DonJayamanne/pythonVSCode/blob/01c3f16217a5777476e59fe8bd7fdb2bc87f26b6/python_files/linter.py#L36-L48) · [More projects using Pylama →](https://dashboard.exa.ai/playground/search?q=pylama%20GitHub%20projects)

**Quickstart**

```python
pylama .

```

From [README.rst](https://github.com/klen/pylama/blob/8.4.1/README.rst)

## FAQ

### Which Python linter should I use?

[Ruff](#ruff) suits most projects, with automatic fixes and rules reimplemented from many other linters. [Pylint](#pylint) suits teams that want deeper inference and design checks alongside Ruff. [Flake8](#flake) suits projects that rely on its plugins.

### What is Ruff?

[Ruff](#ruff) is a Python linter and code formatter written in Rust. It reimplements rule families from other linters and fixes many issues automatically. It does not support custom rules written in Python.

### What is Pylint?

[Pylint](#pylint) is a static checker that finds errors, convention violations, and refactoring opportunities without running the code. It reports in JSON natively and does not fix code automatically.

### What is Flake8?

[Flake8](#flake) combines Pyflakes, pycodestyle, and McCabe checks in one command. Plugins add further rules and report formats.

### Ruff vs Pylint: do I need both?

[Pylint](#pylint) complements [Ruff](#ruff) rather than duplicating its rules. Ruff covers style and correctness checks with automatic fixes. Pylint adds deeper inference and design diagnostics.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python linter libraries Pylint Flake8 pycodestyle Ruff code examples custom rules diagnostics automatic fixes",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
