Skip to main content

Multi-Language Server WebSocket proxy for Jupyter notebook or lab server for Python 3.5+.

Project description

jupyter-lsp

Multi-Language Server WebSocket proxy for your Jupyter notebook or lab server. For Python 3.5+.

See the parent of this repository, jupyterlab-lsp for the reference client implementation for JupyterLab.

Installing language servers

jupyter-lsp does not come with any Language Servers! However, we will try to use them if they are installed and we know about them (you can disable this behavior by configuring autodetect).

Use a package manager to install a language server (also this list) from the tables below: these implementations are tested to work with jupyter-lsp.

language npm install (-g), or yarn/jlpm add (-g)
bash bash-language-server
css
less
sass
vscode-css-languageserver-bin
docker dockerfile-language-server-nodejs
html vscode-html-languageserver-bin
javascript
typescript
javascript-typescript-langserver
json vscode-json-languageserver-bin
markdown unified-language-server
yaml yaml-language-server
language conda install -c conda-forge language-specific package manager
python python-language-server pip install python-language-server
r r-languageserver Rscript -e 'install.packages("languageserver")'

Don't see an implementation for the language server you need? You can bring your own language server.

Please consider contributing your language server spec to jupyter-lsp!

Adding custom language servers

Jupyter config via traitlets

Like the Jupyter Notebook server, JupyterHub and other Jupyter interactive computing tools, jupyter-lsp can be configured via Python or JSON files in well-known locations. You can find out where to put them on your system with:

jupyter --paths

They will be merged from bottom to top, and the directory where you launch your notebook server wins, making it easy to check in to version control.

# ./jupyter_notebook_config.json                 ---------- unique! -----------
#                                               |                              |
# or e.g.                                       V                              V
# $PREFIX/etc/jupyter/jupyter_notebook_config.d/a-language-server-implementation.json
{
  "LanguageServerManager": {
    "language_servers": {
      "a-language-server-implementation": {
        "argv": ["/absolute/path/to/a-language-server", "--stdio"],
        "languages": ["a-language"]
      }
    }
  }
}

More complex configurations that can't be hard-coded may benefit from the python approach:

# jupyter_notebook_config.py
import shutil

# c is a magic, lazy variable
c.LanguageServerManager.language_servers = {
    "a-language-server-implementation": {
        # if installed as a binary
        "argv": [shutil.which("a-language-server")],
        "languages": ["a-language"]
    },
    "another-language-implementation": {
        # if run like a script
        "argv": [shutil.which("another-language-interpreter"), "another-language-server"],
        "languages": ["another-language"]
    }
}

Python entry_points

pip-installable packages in the same environment as the Jupyter notebook server can be automatically detected as providing a language server spec. These are a little more involved: see CONTRIBUTING.

Configuration Options

Like language_servers, these can be configured via jupyter_notebook_config.json (or .py) or via command line arguments to jupyter notebook or jupyter lab.

nodejs

default: autodetect

A custom absolute path to your nodejs executable.

autodetect

default: True

jupyter-lsp will look for all known language servers. User-configured language_servers of the same implementation will be preferred over autodetected ones.

node_roots

default: []

Absolute paths to search for node_modules, such as nodejs-backed language servers. The order is, roughly:

  • the folder where notebook or lab was launched
  • the JupyterLab staging folder
  • wherever conda puts global node modules
  • wherever some other conventions put it

extra_node_roots

default: []

Additional places jupyter-lsp will look for node_modules. These will be checked before node_roots

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter-lsp-0.6.0b0.tar.gz (19.6 kB view details)

Uploaded Source

File details

Details for the file jupyter-lsp-0.6.0b0.tar.gz.

File metadata

  • Download URL: jupyter-lsp-0.6.0b0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for jupyter-lsp-0.6.0b0.tar.gz
Algorithm Hash digest
SHA256 7d554059552ff7fc13fb1dc95bb06b477858516e3d661b157b39744a72214219
MD5 6a703d5da1c2aaf8164ed763c2845115
BLAKE2b-256 1ade25b5351fcfe617f644bc51e50826a031bd4d5c1f5b236c42e739070b8b20

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page