Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Python

Install

Pyright is a fast, feature-rich Python language server from Microsoft.

macOS

npm install -g pyright

Or via Homebrew:

brew install pyright

Linux

npm install -g pyright

Windows

npm install -g pyright

Config

Catenary ships a built-in definition for pyright — no [lsp.server.*] config is needed. If pyright-langserver is on PATH, it works automatically.

To customise settings, add to ~/.config/catenary/config.toml:

[lsp.server.pyright-langserver.settings.python]
pythonPath = "/usr/bin/python3"

[lsp.server.pyright-langserver.settings.python.analysis]
exclude = ["**/target", "**/node_modules"]
extraPaths = []

Settings

Pyright requests configuration via workspace/configuration. Use the settings table on the [lsp.server.*] entry to provide Python interpreter paths, analysis exclusions, and other options (shown above).

Without these settings, pyright may fall back to scanning the entire workspace (including large directories like target/ or node_modules/), which can cause extremely slow initialization.

See the Pyright configuration docs for the full list of available settings.

Notes

  • Pyright provides type checking even for untyped code (infers types)
  • Works well with virtual environments — activate your venv before starting your MCP client
  • For Django/Flask projects, Pyright handles most patterns out of the box

Alternatives

Pylsp (python-lsp-server)

A community-maintained server with plugin support:

pip install python-lsp-server
[lsp.language.python]
servers = ["pylsp"]

No [lsp.server.pylsp] block is needed — the section key pylsp is the binary Catenary spawns; add one with path = "/abs/path" only to relocate it.

Jedi Language Server

Lightweight, uses Jedi for completions:

pip install jedi-language-server
[lsp.language.python]
servers = ["jedi-language-server"]

The section key jedi-language-server is the binary Catenary spawns, so no [lsp.server.*] block is needed — add one with path = "/abs/path" only to relocate a binary that is not on PATH.