My basic understanding is that jedi was an old method to do autocompletion / hints.
The new method is LSP, and we can use an LSP server with jupyterlab through jupyterlab-lsp.
One such LSP server for Python is python-lsp-server.
There is also a jedi-language-server that, as my understanding goes, is a layer that exposes a LSP interface to jedi (the old method).
Now I want to use python-lsp-server.
I use pyenv to manage my virtual environments.
I do:
# This creates a Python 3.12 virtual environment
$ pyenv virtualenv 3.12.0 nojedi
# Basically this activates the environment
$ pyenv local nojedi
# Install packages
$ python -m jupyterlab jupyterlab-lsp "python-lsp-server[all]"
Then:
$ python -m pip list | grep jedi
jedi 0.19.1
Why is jedi installed?
python-lsp-server depends on Jedi.
From its README:
The base language server requires Jedi to provide Completions, Definitions, Hover, References, Signature Help, and Symbols:
The only “obsolete” thing about Jedi when it comes to text editors is having its own API. It didn’t stop being good at Python static analysis.