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

Add to ~/.config/catenary/config.toml:

[server.python]
command = "pyright-langserver"
args = ["--stdio"]

[server.python.settings.python]
pythonPath = "/usr/bin/python3"

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

[language.python]
servers = ["python"]

Settings

Pyright requests configuration via workspace/configuration. Use the settings table on the [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
[server.pylsp]
command = "pylsp"

[language.python]
servers = ["pylsp"]

Jedi Language Server

Lightweight, uses Jedi for completions:

pip install jedi-language-server
[server.jedi]
command = "jedi-language-server"

[language.python]
servers = ["jedi"]