Skip to content

Instantly share code, notes, and snippets.

@agoose77
Last active August 30, 2025 12:52
Show Gist options
  • Save agoose77/9cb87496bd7923afdc28980b8b58a775 to your computer and use it in GitHub Desktop.
Save agoose77/9cb87496bd7923afdc28980b8b58a775 to your computer and use it in GitHub Desktop.
Launch JupyterLab with basic LSP support
[flake8]
# Match black
max-line-length = 88
# Allow asymmetric commas, etc.
extend-ignore =
E203,
# Spurious warnings in JupyterLab for code cells that follow Markdown cells
E303
exclude = .git,__pycache__,build,dist,.venv
max-complexity = 10

JupyterLab linting example

Binder

See overrides.json for user-settings under @jupyter-lsp/jupyterlab-lsp:plugin. This can be installed / linked into <sys-prefix>/share/jupyter/lab/settings

Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"id": "4fcc80ee-5931-4d92-8b0a-b93279921ef2",
"metadata": {},
"outputs": [],
"source": [
"import functools"
]
},
{
"cell_type": "markdown",
"id": "f8f5cbba-80a7-4e84-a649-229cfd6ab29d",
"metadata": {},
"source": [
"## Hover"
]
},
{
"cell_type": "markdown",
"id": "2a3c6d09-8080-478b-a36c-604068cecc33",
"metadata": {},
"source": [
"Hover over any piece of code; if an underline appears, you can press <kbd>Ctrl</kbd> to get a tooltip with function/class signature, module documentation or any other piece of information that the language server provides"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "6001f756-a79c-437e-898e-aef681527f6d",
"metadata": {},
"outputs": [],
"source": [
"f = functools.partial(print, 1)"
]
},
{
"cell_type": "markdown",
"id": "325faf28-3699-4ec9-b51a-27cd3f5d9741",
"metadata": {},
"source": [
"## Diagnostics\n",
"See squiggle below."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "e904414e-c7c1-43b3-b110-09a53c36cc0c",
"metadata": {},
"outputs": [],
"source": [
"import statistics"
]
},
{
"cell_type": "markdown",
"id": "68a45391-e0e6-43b6-9757-cbbcfad7b211",
"metadata": {},
"source": [
"## Continuous hinting\n",
"Set `continuousHinting: true`"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "085367a1-1a30-42f7-b986-7e1157c7a2b6",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"@jupyter-lsp/jupyterlab-lsp:plugin": {
"language_servers": {
"pylsp": {
"priority": 100,
"serverSettings": {
"pylsp.plugins.flake8.config": ".flake8",
"pylsp.plugins.flake8.enabled": true,
"pylsp.plugins.pycodestyle.enabled": false,
"pylsp.plugins.pydocstyle.enabled": false,
"pylsp.plugins.pyflakes.enabled": false,
"pylsp.plugins.pylint.enabled": false,
"pylsp.plugins.yapf.enabled": false
}
}
}
}
}
#!/usr/bin/env bash
set -eux
mkdir -p ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings
cp ./overrides.json ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings
jupyterlab
python-lsp-server[all]
jupyterlab-lsp
# Code formatting
jupyterlab-code-formatter
black
isort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment