Skip to content

Python linters

Ruff

Issues

Usage

Ignore rules: Error suppression, i.e.:

# Ignore E741 and F841.
i = 1  # noqa: E741, F841

# Ignore _all_ violations.
x = 1  # noqa

Pyright

Basedpyright

pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server

  • GitHub
  • Docs
  • Rejected: Support #noqa annotation "The# noqa comment is really meant for linters, Pyright doesn't perform any linting (code style) checks, only type checks."

File-level Type Controls: Globally ignore for whole file (insert at the top of file), i.e.:

# pyright: strict
# pyright: basic
# pyright: strict, reportPrivateUsage=false
# pyright: reportPrivateUsage=warning, reportOptionalCall=error

Line-level Diagnostic Suppression:

# pyright: ignore[reportUnknownArgumentType]
# pyright: reportAny=false,reportUnknownVariableType=false,reportUnknownMemberType=false

basedpyright issues

  • I cannot find a way to both use noqa and pyright:… for the same line

ty

An extremely fast Python type checker and language server, written in Rust. WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.

Suppression:

# ty: ignore[unsupported-operator]
# ty: ignore[missing-argument, invalid-argument-type]
# type: ignore