Skip to content

Commit 00efcca

Browse files
authored
Merge pull request #217 from bollwyvl/add-rtd
Add readthedocs configuration, docs updates
2 parents 2133327 + 40325b0 commit 00efcca

File tree

9 files changed

+94
-30
lines changed

9 files changed

+94
-30
lines changed

.readthedocs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
3+
sphinx:
4+
configuration: docs/conf.py
5+
6+
conda:
7+
environment: docs/rtd.yml
8+
9+
formats:
10+
- htmlzip
11+
- epub

docs/Configuring.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"\n",
137137
"> default: `True`\n",
138138
"\n",
139-
"`jupyter-lsp` will look for all\n",
139+
"If `True`, `jupyter-lsp` will look for all\n",
140140
"[known language servers](#installing-language-servers). User-configured\n",
141141
"`language_servers` of the same implementation will be preferred over\n",
142142
"`autodetect`ed ones."

docs/Installation.ipynb

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,27 @@
1515
"\n",
1616
"Delivering LSP features to your JupyterLab **requires** three pieces:\n",
1717
"\n",
18-
"- `jupyter_lsp`\n",
19-
" - runs in your `notebook` web application on your server\n",
20-
" - to run, you need:\n",
21-
" - `python >=3.5`\n",
22-
" - `notebook >=4.3`\n",
23-
"- `jupyterlab-lsp`\n",
24-
" - runs in your browser\n",
25-
" - to install it, you need:\n",
26-
" - `nodejs >8`\n",
27-
" - `jupyterlab >=1.1,<2`\n",
28-
"- one or more language servers\n",
29-
" - run on your server\n",
30-
" - some can be automatically [detected](./Language%20Servers.ipynb) if\n",
31-
" installed\n",
32-
" - others also need to be [configured](./Configuring.ipynb#language_servers)"
18+
"#### `jupyter-lsp`\n",
19+
"\n",
20+
"- runs in your `notebook` web application on your server to handle requests from\n",
21+
" the browser to _language servers_\n",
22+
"- to run, you need:\n",
23+
" - `python >=3.5`\n",
24+
" - `notebook >=4.3`\n",
25+
"\n",
26+
"#### `jupyterlab-lsp`\n",
27+
"\n",
28+
"- runs in your browser, as an extension to JupyterLab\n",
29+
"- to install it, you need:\n",
30+
" - `nodejs >8`\n",
31+
" - `jupyterlab >=1.1,<2`\n",
32+
"\n",
33+
"#### Language Servers\n",
34+
"\n",
35+
"- run on your server\n",
36+
" - probably in another language runtime than python\n",
37+
"- some can be automatically [detected](./Language%20Servers.ipynb) if installed\n",
38+
"- others also need to be [configured](./Configuring.ipynb#language_servers)"
3339
]
3440
},
3541
{
@@ -49,11 +55,11 @@
4955
"#### conda (minimal python)\n",
5056
"\n",
5157
"```bash\n",
52-
"conda create -c conda-forge -n lsp 'python >=3.7,<3.8' 'jupyterlab=1.2' 'nodejs=11' python-language-server\n",
58+
"conda create -c conda-forge -n lsp 'python >=3.7,<3.8' 'jupyterlab=1.2' 'nodejs>8' python-language-server\n",
5359
"# Also consider: r-languageserver [*]\n",
5460
"source activate lsp\n",
55-
"python -m pip install 'jupyter_lsp=0.7' --no-deps\n",
56-
"jupyter labextension install '@krassowski/jupyterlab-lsp@0.7.1'\n",
61+
"python -m pip install 'jupyter-lsp=0.8.0' --no-deps\n",
62+
"jupyter labextension install '@krassowski/jupyterlab-lsp@0.8.0'\n",
5763
"```\n",
5864
"\n",
5965
"Then run\n",
@@ -91,9 +97,9 @@
9197
" 'python-language-server' \\\n",
9298
" 'r-languageserver' \\\n",
9399
" && python3 -m pip install --no-cache-dir --no-deps \\\n",
94-
" 'jupyter_lsp==0.7' \\\n",
100+
" 'jupyter-lsp=0.8.0' \\\n",
95101
" && jupyter labextension install --no-build \\\n",
96-
" '@krassowski/jupyterlab-lsp@0.7.1' \\\n",
102+
" '@krassowski/jupyterlab-lsp@0.8.0' \\\n",
97103
" && jupyter lab build --dev-build=False --minimize=True \\\n",
98104
" && conda clean --all -f -y \\\n",
99105
" && rm -rf \\\n",
@@ -201,8 +207,8 @@
201207
"#### Install Jupyter[Lab] LSP\n",
202208
"\n",
203209
"```bash\n",
204-
"pip install jupyter_lsp\n",
205-
"jupyter labextension install @krassowitz/jupyterlab-lsp\n",
210+
"pip install jupyter-lsp=0.8.0\n",
211+
"jupyter labextension install @krassowski/jupyterlab-lsp@0.8.0\n",
206212
"```"
207213
]
208214
},
@@ -212,12 +218,12 @@
212218
"source": [
213219
"### Next Step: Language Servers\n",
214220
"\n",
215-
"Now that you have `jupyterlab-lsp`, `jupyter_lsp` and all of their dependencies,\n",
221+
"Now that you have `jupyterlab-lsp`, `jupyter-lsp` and all of their dependencies,\n",
216222
"you'll need some language servers. See:\n",
217223
"\n",
218224
"- [Language Servers](./Language%20Servers.ipynb) that will be found\n",
219225
" automatically once installed\n",
220-
"- [configuring](./Configuring.ipynb) `jupyter_lsp` for more control over which\n",
226+
"- [configuring](./Configuring.ipynb) `jupyter-lsp` for more control over which\n",
221227
" servers to load"
222228
]
223229
}

docs/Language Servers.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"servers in the tables below, use one of the suggested package managers to\n",
1212
"install them: these implementations are tested to work with `jupyter-lsp`.\n",
1313
"\n",
14-
"> _You can disable this feature by configuring_ >\n",
15-
"> _[autodetect](./Configuring.ipynb#autodetect)_\n",
14+
"- _You can disable this feature by configuring_\n",
15+
" [autodetect](./Configuring.ipynb#autodetect)\n",
1616
"\n",
1717
"If you do not see a language you would like, but can find it one of these lists:\n",
1818
"\n",

docs/Releasing.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"source": [
77
"## Releasing\n",
88
"\n",
9-
"`jupyterlab-lsp` and `jupyter_lsp` releases may require building both the python\n",
9+
"`jupyterlab-lsp` and `jupyter-lsp` releases may require building both the python\n",
1010
"package and nodejs packages."
1111
]
1212
},
@@ -22,8 +22,8 @@
2222
"python scripts/integrity.py\n",
2323
"```\n",
2424
"\n",
25-
"> TODO: create a `release.py` script\n",
26-
"> [#88](https://github.com/krassowski/jupyterlab-lsp/issues/88)\n",
25+
"- TODO: create a `release.py` script\n",
26+
" [#88](https://github.com/krassowski/jupyterlab-lsp/issues/88)\n",
2727
"\n",
2828
"The PyPI version must be updated in the following places:\n",
2929
"\n",

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# pylint: disable=invalid-name,redefined-builtin,import-error
44

55
import pathlib
6+
import subprocess
67
import sys
78

89
import nbsphinx
@@ -105,3 +106,4 @@ def setup(app):
105106
""" Runs before the "normal business" of sphinx. Don't go too crazy here.
106107
"""
107108
app.add_css_file("css/custom.css")
109+
subprocess.check_call(["jlpm", "--ignore-optional"])

docs/rtd.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# minimal possible conda env for modern nodejs
2+
name: jupyterlab-lsp-docs
3+
4+
dependencies:
5+
- nodejs
6+
- pip
7+
- python >=3.8,<3.9.0a0
8+
- pip:
9+
- -e ..
10+
- graphviz
11+
- importlib_metadata
12+
- jupyterlab >=1,<1.3.0a0
13+
- nbsphinx >=0.5.0,<0.5.1a0
14+
- pandas
15+
- pytest-check-links
16+
- python-language-server
17+
- recommonmark
18+
- sphinx
19+
- sphinx_rtd_theme
20+
- sphinx-autodoc-typehints
21+
- sphinx-copybutton
22+
- sphinx-markdown-tables

py_src/jupyter_lsp/specs/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import shutil
23
from pathlib import Path
34
from typing import List, Text
@@ -12,6 +13,9 @@
1213
# helper scripts for known tricky language servers
1314
HELPERS = Path(__file__).parent / "helpers"
1415

16+
# when building docs, let all specs go through
17+
BUILDING_DOCS = os.environ.get("JUPYTER_LSP_BUILDING_DOCS") is not None
18+
1519

1620
class SpecBase:
1721
""" Base for a spec finder that returns a spec for starting a language server
@@ -41,6 +45,9 @@ def __call__(self, mgr: LanguageServerManagerAPI) -> KeyedLanguageServerSpecs:
4145
if cmd:
4246
break
4347

48+
if not cmd and BUILDING_DOCS: # pragma: no cover
49+
cmd = self.cmd
50+
4451
if not cmd: # pragma: no cover
4552
return {}
4653

scripts/integrity.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
PIPE_FILE = ROOT / "azure-pipelines.yml"
5959
PIPELINES = yaml.safe_load(PIPE_FILE.read_text())
6060
PIPE_VARS = PIPELINES["variables"]
61+
DOCS = ROOT / "docs"
6162

6263
CI = ROOT / "ci"
6364

@@ -80,6 +81,13 @@ def the_meta_package():
8081
)
8182

8283

84+
@pytest.fixture(scope="module")
85+
def the_installation_notebook():
86+
""" loads up the installation notebook
87+
"""
88+
return (DOCS / "Installation.ipynb").read_text()
89+
90+
8391
@pytest.mark.parametrize(
8492
"name,version",
8593
[["PY_JLSP_VERSION", PY_VERSION], ["JS_JLLSP_VERSION", MAIN_EXT_VERSION]],
@@ -141,6 +149,14 @@ def test_changelog_versions(pkg, version):
141149
assert "## `{} {}`".format(pkg, version) in CHANGELOG.read_text()
142150

143151

152+
@pytest.mark.parametrize(
153+
"pkg,sep,version,expected",
154+
[[PY_NAME, "=", PY_VERSION, 3], [MAIN_NAME, "@", MAIN_EXT_VERSION, 3]],
155+
)
156+
def test_installation_versions(the_installation_notebook, pkg, sep, version, expected):
157+
assert the_installation_notebook.count(f"{pkg}{sep}{version}") == expected
158+
159+
144160
def check_integrity():
145161
""" actually run the tests
146162
"""

0 commit comments

Comments
 (0)