unlike pyright, the basedpyright CLI & LSP are available as a pypi package instead of an npm package.
this makes it far more convenient for python developers to use, since there's no need to install any additional tools. just install it normally via your package manager of choice:
pdm add basedpyright
rye add basedpyright
uv pip install basedpyright
pip install basedpyright
once installed, the basedpyright
and basedpyright-langserver
scripts will be available in your python environment. when running basedpyright via the command line, use the basedpyright
command:
basedpyright --help
for instructions on how to use basedpyright-langserver
, see the IDE-specific instructions below.
most of these IDE plugins require the pypi package to be installed.
install the extension from the vscode extension marketplace or the open VSX registry
You need to install the LSP client addapter plugin, nvim-lspconfig, for setting up the LSP for the editor. These configurations are for launching the LSP server, as well as for being able to give launching parameters at the same time.
To install the necessary sever command, for the LSP server itself, use the pypi package installation method (as mentioned previously in this section). Or if already using Mason.nvim, follow their instructions for installing their packages. The latter approach allows you to have the version of BasedPyright maintained and upgraded by Mason project.
BasedPyright is available through the
nvim-lspconfig
adapter for native Neovim's LSP support.
After having both, the client-side plugin and the LSP server command installed, simply add this settings to your Neovim's settings:
local lspconfig = require("lspconfig")
lspconfig.basedpyright.setup{}
Further info for this LSP server options for nvim-lspconfig
are available on
their docs, linked above.
Vim users can install coc-basedpyright, the BasedPyright extension for coc.nvim.
Sublime text users can install both LSP and LSP-basedpyright via Package Control.
Emacs users have 3 options:
basedpyright is the default language server for python in lsp-bridge, so no additional configuration is required.
add the following to your emacs config:
(add-to-list 'eglot-server-programs
'((python-mode python-ts-mode)
"basedpyright-langserver" "--stdio"))
with lsp-pyright
Warning
this has not been tested with basedpyright. i think it's hardcoded to use pyright so it might not work
install the Pyright plugin
configure it to use basedpyright by specifying the path to the basedpyright-langserver
executable and set "Running mode" to "LSP4IJ":