A Claude Code plugin that connects Claude to BasedPyright, giving it real Python code intelligence: go to definition, find references, hover types, document symbols and type-checking diagnostics after every edit.
It is a drop-in alternative to the official pyright-lsp plugin for people who
prefer BasedPyright's stricter checks and extra features.
- Claude Code
basedpyright-langserveravailable on thePATHof the process that runs Claude Code
The plugin does not bundle or install BasedPyright. You install and update it yourself, so the plugin never changes anything on your machine.
Pick one:
uv tool install basedpyright # recommended
pipx install basedpyright
pip install basedpyright # into the active environment
npm install -g basedpyrightCheck it is on your PATH:
basedpyright --version
# macOS / Linux
command -v basedpyright-langserver
# Windows (PowerShell)
Get-Command basedpyright-langserverclaude plugin marketplace add datacas/claude-basedpyright-lsp
claude plugin install basedpyright-lsp@basedpyright-marketplaceOr from inside Claude Code:
/plugin marketplace add datacas/claude-basedpyright-lsp
/plugin install basedpyright-lsp@basedpyright-marketplace
Restart Claude Code after installing.
Important
Do not enable this plugin and the official pyright-lsp plugin at the same time.
Both handle Python files, so you would run two servers on the same code.
claude plugin uninstall pyright-lsp@claude-plugins-officialThird-party marketplaces do not auto-update by default. Update manually:
claude plugin marketplace update basedpyright-marketplace
claude plugin update basedpyright-lsp@basedpyright-marketplaceor turn on auto-update for this marketplace from /plugin > Marketplaces.
BasedPyright itself is updated separately (uv tool upgrade basedpyright).
The plugin sends no settings of its own. BasedPyright reads your project's
configuration as usual, from pyproject.toml:
[tool.basedpyright]
typeCheckingMode = "standard" # off | basic | standard | strict | recommended | all
venvPath = "."
venv = ".venv"or from pyrightconfig.json. See the
BasedPyright configuration docs.
If your project uses a virtual environment, point venvPath/venv at it so imports
resolve.
Open Claude Code in a Python project and ask:
Use the LSP tool to list the document symbols of
path/to/file.py, then find all references to<some function>.
Claude should call the LSP tool (documentSymbol, findReferences, ...) rather
than grepping. You can also run /plugin and check that basedpyright-lsp is
enabled without errors.
Executable not found in $PATH / the server never starts.
Claude Code inherits PATH from wherever it was launched.
uv toolandpipxinstall into~/.local/bin. Runuv tool update-shellorpipx ensurepath, open a new terminal, and start Claude Code from it.- macOS: apps started from the Dock or Spotlight do not read your shell profile. Start Claude Code from a terminal.
- Windows: make sure the scripts folder (e.g.
%USERPROFILE%\.local\binor your PythonScriptsfolder) is in your userPATH, then restart the terminal. - WSL: install BasedPyright inside the WSL distribution, not on Windows.
Imports are reported as unresolved.
BasedPyright cannot find your environment. Configure venvPath/venv (see above),
or start Claude Code with the virtual environment activated.
Too many (or too few) diagnostics.
Adjust typeCheckingMode or individual rules in your project config. The plugin
itself does not change the checking level.
Slow startup on large projects.
The plugin allows 30 seconds for the server to start. Exclude generated or vendored
folders with exclude in your config to speed up analysis.
git clone https://github.com/datacas/claude-basedpyright-lsp
cd claude-basedpyright-lsp
claude plugin validate --strict . # marketplace manifest
claude plugin validate --strict plugins/basedpyright-lsp # plugin manifest
python tests/lsp_smoke.py # end-to-end LSP check
# Try your local checkout in Claude Code
claude --plugin-dir ./plugins/basedpyright-lsptests/lsp_smoke.py starts the server with the exact command from .lsp.json and
checks diagnostics, documentSymbol, hover, definition and references. CI runs
it on Linux, macOS and Windows against pinned versions (BasedPyright in
tests/requirements.txt, Claude Code in the workflow), plus a weekly run against the
latest releases.
main is protected: every change goes through a pull request, and the pull request
merges (squash only) once CI passes on all platforms. When a change affects the
plugin, bump version in plugin.json and add an entry to CHANGELOG.md, since
installed copies only update when the version changes. CI fails if the version in
plugin.json has no CHANGELOG.md entry.
To release, push a tag matching the version from an up-to-date main:
git tag v1.2.0 && git push origin v1.2.0The release workflow checks that the tag matches plugin.json and publishes a
GitHub release with the CHANGELOG.md notes for that version.
Security issues: see SECURITY.md.
.claude-plugin/marketplace.json # marketplace catalog
plugins/basedpyright-lsp/
.claude-plugin/plugin.json # plugin manifest
.lsp.json # language server definition
tests/ # LSP smoke test and fixtures
MIT. BasedPyright is a separate project with its own license. This project is not affiliated with Anthropic or the BasedPyright maintainers.