Skip to content

About

BasedPyright language server plugin for Claude Code

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BasedPyright LSP for Claude Code

CI License: MIT

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.

Requirements

  • Claude Code
  • basedpyright-langserver available on the PATH of 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.

1. Install BasedPyright

Pick one:

uv tool install basedpyright     # recommended
pipx install basedpyright
pip install basedpyright         # into the active environment
npm install -g basedpyright

Check it is on your PATH:

basedpyright --version
# macOS / Linux
command -v basedpyright-langserver
# Windows (PowerShell)
Get-Command basedpyright-langserver

2. Install the plugin

claude plugin marketplace add datacas/claude-basedpyright-lsp
claude plugin install basedpyright-lsp@basedpyright-marketplace

Or 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-official

Updating

Third-party marketplaces do not auto-update by default. Update manually:

claude plugin marketplace update basedpyright-marketplace
claude plugin update basedpyright-lsp@basedpyright-marketplace

or turn on auto-update for this marketplace from /plugin > Marketplaces. BasedPyright itself is updated separately (uv tool upgrade basedpyright).

Configuration

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.

Verify that Claude is using it

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.

Troubleshooting

Executable not found in $PATH / the server never starts. Claude Code inherits PATH from wherever it was launched.

  • uv tool and pipx install into ~/.local/bin. Run uv tool update-shell or pipx 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\bin or your Python Scripts folder) is in your user PATH, 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.

Development

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-lsp

tests/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.

Contributing

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.0

The 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.

Repository layout

.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

License

MIT. BasedPyright is a separate project with its own license. This project is not affiliated with Anthropic or the BasedPyright maintainers.

About

BasedPyright language server plugin for Claude Code

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages