Mypy Linter for Python LSP Server

0.7.1 · active · verified Thu Apr 16

pylsp-mypy is a plugin for the Python LSP Server that integrates Mypy for static type checking. It provides live diagnostics as you type or on file save. The library is currently at version 0.7.1 and maintains an active release cadence, frequently updating to support new `mypy` and `python-lsp-server` features and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

To use `pylsp-mypy`, install it alongside `python-lsp-server` and `mypy` in your development environment. Configuration is typically done via a `[tool.pylsp-mypy]` section in your `pyproject.toml` file, where you can enable it, set `live_mode` for as-you-type checks, and enable `strict` Mypy rules.

# 1. Install pylsp-mypy (and python-lsp-server) in your project's virtual environment:
pip install python-lsp-server pylsp-mypy mypy

# 2. Add or update your pyproject.toml to enable and configure pylsp-mypy:
# (This example enables live mode and strict checking)
# [tool.pylsp-mypy]
# enabled = true
# live_mode = true
# strict = true
# exclude = ["tests/*"]

# 3. Open a Python file in your LSP-compatible editor (e.g., VS Code, Neovim, Emacs)
# The LSP server will automatically detect and load pylsp-mypy for type checking.

view raw JSON →