Executable and language server executable#
The plugin will automatically search for executables to use (in PATH and the parent directory of the current project's interpreter). However, they can also be manually configured if so desired.
The pyright
(or pyright-python
) and
pyright-langserver
(or pyright-python-langserver
) files
can be found in the following locations:
Note
The locations mentioned here are for Pip and NPM-like managers. For other tools (e.g. Homebrew), see their documentation to know where they store their executable files.
Manager | Type | OS | Directory |
---|---|---|---|
NPM | Global | Windows | %APPDATA%\npm |
NPM | Global | Linux | /usr/local/bin |
Pip | Global | Windows | %LOCALAPPDATA%\Programs\Python\<version>\Scripts |
Pip | Global | Linux | ~/.local/bin |
NPM | Local | Windows | .\node_modules\.bin |
NPM | Local | Linux | ./node_modules/.bin |
Pip | Local | Windows | .\<your-venv>\Scripts |
Pip | Local | Linux | ./<your-venv>/bin |
If the executables can't be found in the aforementioned locations, see the following pages for more information:
- Where does npm install packages? - Stack Overflow
- Where does pip install its packages? - Stack Overflow
- folders - npm Docs
The executables are used as-is with no additional checks. This is useful if you want to use a Pyright fork or a custom script.
Tip
For the best experience, always use or maintain compatibility with the latest version of Pyright.
Resolving strategy#
If a relative path is specified, it would be interpreted as relative to the project directory.
The plugin also supports a "smart" resolving strategy via the "Resolve against interpreter directory, ignoring extension" setting.
How to always use the Pyright executables from virtual environments?
Set "Executable" to pyright
and "Language server executable" to
pyright-langserver
, then enable the two checkboxes.
Configuration file#
Used by running mode(s) | Default | Corresponding CLI option |
---|---|---|
Command line | Project's root directory | --project |
Despite being called "file", this can be a path to a directory
containing a pyrightconfig.json
and/or a pyproject.toml
(the former takes precedence if both are present).
- If a local executable is specified, the local path is used.
- If only the global executable is specified, the local path is used.
- If no local configuration file is specified, the global is used.
If the path retrieved using the aforementioned strategy is not specified, the project's root directory is used.
Note
This configuration is deliberately unsupported in LSP modes. The language server will search for the configuration file(s) inside the root directory of the workspace.