Coder Social home page Coder Social logo

Comments (6)

MordorianGuy avatar MordorianGuy commented on June 7, 2024 1

By pylsp can be configured to include search paths from other locations do you mean via the hidden symlink trick I've seen somewhere around the docs, or is there another configuration I can try?

No, I mean that pylsp has pylsp.plugins.jedi.extra_paths option (https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md) which tells Jedi (a library used by pylsp for completion and some other features) to search in specific paths for installed libraries.

What packages need to be installed where?

Depends on your configuration; one option is:

* JupyterLab environment: jupyter-lsp, jupyterlab-lsp, pylsp + install all libraries you import on runtime

* Kernel environment: all libraries you import on runtime

Another option is:

* JupyterLab environment: jupyter-lsp, jupyterlab-lsp, pylsp + configure `pylsp.plugins.jedi.extra_paths` to point to kernel environment

* Kernel environment: all libraries you import on runtime

But the second option only works if the lab environment can see the kernel environment (e.g. they are on the same machine).

Do I understand you right that these both options bind the jupyterlab environment to only one working kernel environment? Is there a general way to use autocompletion & jumping to sources while I am working with multiple environments at a time?

P.S. My case include only local environments on the same machine/OS.

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 7, 2024

Kernel should provide their own completions and LSP their own. These are merged and reconciled so you should be getting both. I would suggest checking in settings whether kernel completions do not happen to be disabled.

from jupyterlab-lsp.

TheMightyOnyx avatar TheMightyOnyx commented on June 7, 2024

Thank you for the reply! Unfortunately it doesn't seem to be working that way for me, unless I missed some configuration:

Lab pod (with jupyterlab-lsp, jupyter-lsp and python-lsp-server installed):

root@jupyter:/srv/jupyterhub# pip list | grep lsp
jupyter-lsp                2.2.2
jupyterlab-lsp             5.0.2
python-lsp-jsonrpc         1.1.2
python-lsp-server          1.10.0

Kernel (with jupyter-lsp (wasn't sure if necessary but did it just in case) and python-lsp-server installed):

edw@hadoop-yarn-nodemanager-0:/$ pip list | grep lsp
jupyter-lsp                  2.2.2
jupyterlab-lsp               5.0.2
python-lsp-jsonrpc           1.1.2
python-lsp-server            1.10.0

Path has autocomplete:
image

Pandas doesn't do anything:
image

Relevant settings (I tried setting the timeout to 10000):
image

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 7, 2024

Currently the completions from IPython kernel only work after you actually imported the Path from pathlib/DataFrame from pandas and defined the variable you are trying to complete on (a). It is not clear from the screenshot if that was the case. For local installations pylsp can be configured to include search paths from other locations, I am not sure if this would work for remote kernels though.

from jupyterlab-lsp.

TheMightyOnyx avatar TheMightyOnyx commented on June 7, 2024

The a variable was already defined at the time of me trying to get completions for it (the a.values is printed below in the screenshot). So just for me to see if I understand correctly so I can experiment with this further, the auto discover functionality of jupyterlab-lsp uses the lsp installed on the remote kernel? Or how do the kernel side completions work?

What packages need to be installed where?
Jupyterlab: jupyter-lsp, jupyterlab-lsp and pylsp
Kernel: pylsp? jupyter-lsp?

By pylsp can be configured to include search paths from other locations do you mean via the hidden symlink trick I've seen somewhere around the docs, or is there another configuration I can try?

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 7, 2024

By pylsp can be configured to include search paths from other locations do you mean via the hidden symlink trick I've seen somewhere around the docs, or is there another configuration I can try?

No, I mean that pylsp has pylsp.plugins.jedi.extra_paths option (https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md) which tells Jedi (a library used by pylsp for completion and some other features) to search in specific paths for installed libraries.

What packages need to be installed where?

Depends on your configuration; one option is:

  • JupyterLab environment: jupyter-lsp, jupyterlab-lsp, pylsp + install all libraries you import on runtime
  • Kernel environment: all libraries you import on runtime

Another option is:

  • JupyterLab environment: jupyter-lsp, jupyterlab-lsp, pylsp + configure pylsp.plugins.jedi.extra_paths to point to kernel environment
  • Kernel environment: all libraries you import on runtime

But the second option only works if the lab environment can see the kernel environment (e.g. they are on the same machine).

from jupyterlab-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.