All Projects → alefpereira → pyenv-pyright

alefpereira / pyenv-pyright

Licence: MIT license
Setup a pyenv virtualenv for microsoft pyright in the pyrightconfig.json config file

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to pyenv-pyright

ansible-pyenv
Ansible role to install pyenv on Ubuntu or macOS development machines
Stars: ✭ 46 (-9.8%)
Mutual labels:  pyenv, pyenv-virtualenv
pyenv-win
pyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.
Stars: ✭ 1,815 (+3458.82%)
Mutual labels:  pyenv
pythonfinder
PythonFinder: Cross Platform Search Tool for Finding Pythons
Stars: ✭ 30 (-41.18%)
Mutual labels:  pyenv
xxenv-latest
This **env(pyenv, rbenv, nodenv, goenv, phpenv, luaenv) plugin replaces the version specified in the argument with the latest version.
Stars: ✭ 69 (+35.29%)
Mutual labels:  pyenv
dotfiles
💾 personal configuration files
Stars: ✭ 42 (-17.65%)
Mutual labels:  pyenv
py lsp.nvim
Lsp Plugin for working with Python virtual environments
Stars: ✭ 58 (+13.73%)
Mutual labels:  pyright
pyenv
Pyenv support plugin for fish-shell
Stars: ✭ 62 (+21.57%)
Mutual labels:  pyenv
travis-pyenv
Set up pyenv to use in Travis CI
Stars: ✭ 17 (-66.67%)
Mutual labels:  pyenv
ubuntu-win-bootstrap
DEPRECIATED! Use "linux-comfy-chair" instead. A very simple bootstrap script to install some development tools to the Windows 10 Ubuntu Bash system - Ruby, Perl, Python, Node, Sublime Text and more!
Stars: ✭ 27 (-47.06%)
Mutual labels:  pyenv
ansible-galaxy-pyenv
Ansible Galaxy role for pyenv
Stars: ✭ 56 (+9.8%)
Mutual labels:  pyenv
pyenv-mode-auto
Automatically activates pyenv version within Emacs if .python-version file exists.
Stars: ✭ 23 (-54.9%)
Mutual labels:  pyenv
micropython-stubs
Stubs of common micropython modules to aid in code completion, static typechecking and overall development
Stars: ✭ 46 (-9.8%)
Mutual labels:  pyright

pyenv-pyright

pyenv-pyright is a pyenv plugin to help setup Microsoft Pyright LSP Server to use virtualenv for local projects. This plugin helps to create or update venvPath and venv attributes in pyright config file pyrightconfig.json to pyenv virtualenvs.

This plugin may come in handy when working with pyright in neovim while using pyenv to manage your virtualenvs, since pyright doesn't uses pyenv set with pyenv local, a good way to overcome this problem is to explicitly set the desired venv in pyright config file pyrightconfig.json. So with this plugin you can do this with only one command:

pyenv pyright

Installation

This will install the latest development version of pyenv-pyright into the $(pyenv root)/plugins/pyenv-pyright directory.

Important note: If you installed pyenv into a non-standard directory, make sure that you clone this repo into the 'plugins' directory of wherever you installed into.

$ git clone https://github.com/alefpereira/pyenv-pyright.git $(pyenv root)/plugins/pyenv-pyright

Usage

  • From an activated pyenv virtualenv (set by pyenv local for example) run pyenv pyright to set pyright config file to this venv:
 (myvenv) pyenv pyright
  • Considering you have a pyenv virtualenv named myvenv, to set pyright config file to use this virtualenv, pass it as argument:
 pyenv pyright myvenv

Note: It works only for virtualenvs, it doesn't work for python instalations, for example pyenv pyright 3.10.0 won't work.

  • Command help:
pyenv pyright --help

Usage: pyenv pyright [virtualenv]
       pyenv pyright --help

       [virtualenv] should be a Python version known to pyenv.

Additional Notes

Update existing pyrightconfig.json file:

This script creates pyright LSP server config file pyrightconfig.json in the current directory, setting its venv attribute to selected virtualenv and venvPath to PYENV_ROOT/versions. If pyrightconfig.json file already exists, the script will update those attributes in the existing file instead.

Uses pyenv-virtualenv for venv management and command completions:

The pyenv-pyright plugin supports only virtualenvs known to pyenv, and pyenv-virtualenv is the way to go for venv management in pyenv. This plugin requires pyenv-virtualenv not only for the venvs but also for command completions.

If your workflow don't involve using venvs or you don't use pyenv-virtualenv, pyenv-pyright plugin may not have any use for you. But if you use venvs, and use pyenv to manage python versions, you probably use pyenv-virtualenv to manage venvs. If you installed pyenv using its installing tool pyenv-installer you already have pyenv-virtualenv (if you are not sure check by running pyenv virtualenvs), in case you don't have it installed yet, install it using the guide in pyenv-virtualenv installing section or with the pyenv-installer tool.

License

(The MIT License)

  • Copyright (c) 2015 Yamashita, Yuu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].