pyenv-pyright icon indicating copy to clipboard operation
pyenv-pyright copied to clipboard

Setting Path for Shared Repos

Open Californian opened this issue 2 years ago • 1 comments

This currently uses an absolute path, with the current user's username, to set the venv path.

In the pyright docs, it says: "If you are working on a project with other developers, it is best not to specify this setting in the config file, since this path will typically differ for each developer. Instead, it can be specified on the command line or in a per-user setting.".

What have you found to be best practice for dealing with this situation?

Californian avatar Dec 02 '22 21:12 Californian

Hi @Californian, the command-line.md from pyright docs states that you can use the option --venv-path together with a shared config file. I haven't tested it but would be something like pyright-langserver --venv-path $(pyenv prefix).

If you use pyright inside nvim you'd probably need to change your server config:

require'lspconfig'.pyright.setup{
      cmd = { "pyright-langserver", "--venv-path", "<venv-path>", "--stdio" }
}

Don't know if you can use $(pyenv prefix) directly in the cmd, but if its not the case, I'm sure there is an ease way to do it (get the venv path/run this command) in the lua config (I just can't tell you off the top of my head).

Hope it helps. BR.

alefpereira avatar Jan 20 '23 00:01 alefpereira