alefpereira / pyenv-pyright

Setup a pyenv virtualenv for microsoft pyright in the pyrightconfig.json config file
MIT License
136 stars 10 forks source link

Setting Path for Shared Repos #1

Open Californian opened 1 year ago

Californian commented 1 year ago

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?

alefpereira commented 1 year ago

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.