0

I am using jedi and more specifically deoplete-jedi in neovim and I wonder if I should install it in every project as a dependency or if I can let jedi reside in the same python environment as neovim uses (and set the setting to tell deoplete-jedi where to look)

It seems wasteful to have to install it in ever project but then again IDK how it would find my project environment from within the neovim environment either.

Joff
  • 11,247
  • 16
  • 60
  • 103
  • 1
    As far as I know you should just install deoplete-jedi by using `git install --recursive ...`. Jedi is vendored in that project, so you can just use the submodules instead of reinstalling it everywhere. https://github.com/deoplete-plugins/deoplete-jedi/tree/master/rplugin/python3/deoplete/vendored – Dave Halter Aug 14 '19 at 22:02

1 Answers1

2

If by the word "project"you mean Python virtual environments then yes, you have to install every program and every library that you use to every virtualenv separately. flake8, pytest, jedi, whatever. Python virtual environments are intended to protect one set of libraries from the other so that you could install different sets of libraries and even different versions of libraries. The price is that you have to duplicate programs/libraries that are used often.

There is a way to connect a virtualenv to the globally installed packages but IMO that brings more harm than good.

phd
  • 82,685
  • 13
  • 120
  • 165
  • ok good to know. I thought there might be a slick way somewhere that jedi would find the env. I've seen node autocompleters that do that – Joff Aug 15 '19 at 01:43
  • @deltaskelta Jedi finds virtualenvs. There are multiple commands to do that. Also activating a virtualenv before opening nvim helps. – Dave Halter Aug 15 '19 at 19:41
  • @DaveHalter so I can install Jedi in the same venv as my Neovim python package and then activate a project (different from Jedi's) venv before opening nvim and Jedi will reflect completions and everything from my project environment and not the environment that Jedi is installed to? – Joff Aug 16 '19 at 03:30
  • If you use deoplete, you shouldn't install jedi in a venv. Deoplete already brings Jedi. – Dave Halter Aug 16 '19 at 09:17
  • Usually you can install Jedi globally (or in its own environment) and set the module path in your IDE config. You should only install project dependencies in virtual environment, not developer toolset dependencies. Different developers working on the same project might use different IDEs, it makes no sense to brig in all possible configs. – cprn Feb 17 '21 at 15:53
  • @cprn "*You should only install project dependencies in virtual environment, not developer toolset dependencies.*" Not true. One certainly should install developers tools for **development**. It's the final **deployment** virtual env shouldn't contain developer tools. "*Different developers working on the same project might use different IDEs*" Yes, and what? Everyone has their own virtual environments, they surely can install as many developer tools as they want without stomping each other. – phd Feb 17 '21 at 16:28
  • @phd On your local virtual env, sure, do whatever. At some point, however, you need to share dependencies and what's the point of installing e.g. both `jedi` and `pyls` just because two devs use different completion engines? Doesn't it make more sense to keep dependencies of IDEs separate from the project dependencies? Yes, dependencies like `pytest` should be pushed to repo in `requirements-dev.txt` but IMHO something like Jedi shouldn't. Neither project nor its development requires Jedi, IDE does. – cprn Feb 18 '21 at 00:22