- Fri 12 February 2021
- Python
- Marius Mather
- #python, #jupyter, #tools
Autocompletion of variable names in Jupyter Lab (or Notebook)
can be frustratingly inconsistent. For a smoother development
experience, the jupyterlab-lsp
extension provides better completions using the same
language servers as Visual Studio Code.
Note that this is only available in Jupyter Lab 3+, not Jupyter Notebook.
To install it in your conda environement, run:
conda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp python-language-server
(or add the packages to your environment.yml
file).
Autocompletion
To use regular Tab-completion, start typing in a code cell, hit Tab
, and
you should get a list of possible completions, including type
information and documentation:
To access documentation once the code's been written, you can hover
your mouse over a function/class call and hit Ctrl
:
Style tips
The extension also offers some features similar to Visual Studio Code or Python IDEs, like highlighting poor style or possible errors in your code (these can be disabled):
(code examples from https://nbviewer.jupyter.org/url/norvig.com/ipython/Probability.ipynb)