Skip to content

Commit cb3586e

Browse files
committed
some docs about latex, warm up cache
1 parent 2810db2 commit cb3586e

File tree

5 files changed

+96
-9
lines changed

5 files changed

+96
-9
lines changed

ci/job.test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ jobs:
6969
- script: ${{ platform.activate }} && python scripts/jedi_cache.py
7070
displayName: warm up jedi cache
7171

72+
- script: ${{ platform.activate }} && python scripts/tectonic_cache.py
73+
displayName: warm up tectonic cache
74+
7275
- script: ${{ platform.activate }} && jlpm test
7376
displayName: run frontend unit tests
7477

docs/Installation.ipynb

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,27 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"from markdown import markdown\n",
1211
"import sys\n",
13-
"sys.path.insert(0, '..')\n",
12+
"\n",
13+
"from markdown import markdown\n",
14+
"\n",
15+
"sys.path.insert(0, \"..\")"
16+
]
17+
},
18+
{
19+
"cell_type": "code",
20+
"execution_count": null,
21+
"metadata": {
22+
"hide_input": true
23+
},
24+
"outputs": [],
25+
"source": [
1426
"from versions import (\n",
1527
" JUPYTER_LSP_VERSION,\n",
1628
" JUPYTERLAB_LSP_VERSION,\n",
1729
" JUPYTERLAB_NEXT_MAJOR_VERSION,\n",
1830
" JUPYTERLAB_VERSION,\n",
19-
" REQUIRED_JUPYTERLAB\n",
31+
" REQUIRED_JUPYTERLAB,\n",
2032
")"
2133
]
2234
},
@@ -85,7 +97,7 @@
8597
"#### conda (minimal python)\n",
8698
"\n",
8799
"```bash\n",
88-
"conda create -c conda-forge -n lsp 'python >=3.7,<3.8' 'jupyterlab={JUPYTERLAB_VERSION}' 'nodejs>8' python-language-server\n",
100+
"conda create -c conda-forge -n lsp 'python >=3.7,<3.8' 'jupyterlab={JUPYTERLAB_VERSION}' 'nodejs>10' python-language-server\n",
89101
"# Also consider: r-languageserver [*]\n",
90102
"source activate lsp\n",
91103
"python -m pip install 'jupyter-lsp={JUPYTER_LSP_VERSION}' --no-deps\n",
@@ -125,13 +137,15 @@
125137
"##### `Dockerfile`\n",
126138
"\n",
127139
"```dockerfile\n",
128-
"# This already contains the python, r, julia, and nodejs runtimes\n",
140+
"# This already contains the python, r, julia, latex, and nodejs runtimes\n",
129141
"FROM jupyter/datascience-notebook@sha256:73a577b006b496e1a1c02f5be432f4aab969c456881c4789e0df77c89a0a60c2\n",
130142
"\n",
131-
"RUN conda install --quiet --yes --freeze-installed \\\n",
143+
"RUN conda install --quiet --yes --freeze-installed -c conda-forge \\\n",
132144
" 'python-language-server' \\\n",
133145
" 'jupyterlab={JUPYTERLAB_VERSION}' \\\n",
134146
" 'r-languageserver' \\\n",
147+
" 'texlab' \\\n",
148+
" 'chktex' \\\n",
135149
" && python3 -m pip install --no-cache-dir --no-deps \\\n",
136150
" 'jupyter-lsp={JUPYTER_LSP_VERSION}' \\\n",
137151
" && jupyter labextension install --no-build \\\n",
@@ -285,7 +299,7 @@
285299
"name": "python",
286300
"nbconvert_exporter": "python",
287301
"pygments_lexer": "ipython3",
288-
"version": "3.7.5"
302+
"version": "3.7.6"
289303
}
290304
},
291305
"nbformat": 4,

docs/Language Servers.ipynb

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
},
133133
"outputs": [],
134134
"source": [
135-
"nb_langs = [\"pyls\", \"r-languageserver\", \"texlab\"]\n",
135+
"nb_langs = [\"pyls\", \"r-languageserver\"]\n",
136136
"lang_server_table(\n",
137137
" {key: spec for key, spec in mgr.language_servers.items() if key in nb_langs}\n",
138138
")"
@@ -199,6 +199,48 @@
199199
"install them with [extra_node_roots](./Configuring.ipynb#extra_node_roots)."
200200
]
201201
},
202+
{
203+
"cell_type": "markdown",
204+
"metadata": {},
205+
"source": [
206+
"### Other Scientific Languages\n",
207+
"\n",
208+
"These servers have been mostly tested with file editor."
209+
]
210+
},
211+
{
212+
"cell_type": "code",
213+
"execution_count": null,
214+
"metadata": {
215+
"hide_input": true
216+
},
217+
"outputs": [],
218+
"source": [
219+
"sci_langs = [\"texlab\"]\n",
220+
"lang_server_table(\n",
221+
" {key: spec for key, spec in mgr.language_servers.items() if key in sci_langs}\n",
222+
")"
223+
]
224+
},
225+
{
226+
"cell_type": "markdown",
227+
"metadata": {},
228+
"source": [
229+
"#### Example: Getting a $\\LaTeX$ stack\n",
230+
"\n",
231+
"```bash\n",
232+
"conda install -y conda-forge tectonic texlab chktex\n",
233+
"```\n",
234+
"\n",
235+
"This will install:\n",
236+
"\n",
237+
"- `tectonic`, a cross-platform $\\LaTeX$ processing tool\n",
238+
" - note, it will download a large number of packages when first executed\n",
239+
"- `texlab`, a Language Server for `.tex` files that supports completion and\n",
240+
" refernce navigation\n",
241+
"- `chktex`, a `.tex` style checker"
242+
]
243+
},
202244
{
203245
"cell_type": "code",
204246
"execution_count": null,

py_src/jupyter_lsp/specs/texlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Texlab(ShellSpec):
1212
home="https://texlab.netlify.app",
1313
issues="https://github.com/latex-lsp/texlab/issues",
1414
),
15-
install=dict(conda="conda install -c conda-forge texlab"),
15+
install=dict(conda="conda install -c conda-forge texlab chktex"),
1616
config_schema=load_config_schema(key),
1717
env=dict(RUST_BACKTRACE="1"),
1818
)

scripts/tectonic_cache.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import subprocess
2+
from pathlib import Path
3+
from tempfile import TemporaryDirectory
4+
5+
HERE = Path(__file__).parent
6+
EXAMPLE = HERE.parent / "atest/examples/example.tex"
7+
8+
9+
def tectonic_cache():
10+
""" warm up the tectonic cache so that it doesn't fail the acceptance test
11+
"""
12+
with TemporaryDirectory() as td:
13+
tdp = Path(td)
14+
tex = tdp / "example.tex"
15+
tex.write_text(
16+
"\n".join(
17+
[
18+
line
19+
for line in EXAMPLE.read_text().splitlines()
20+
if "\\foo" not in line
21+
]
22+
)
23+
)
24+
subprocess.check_call(["tectonic", str(tex)], cwd=td)
25+
26+
27+
if __name__ == "__main__":
28+
tectonic_cache()

0 commit comments

Comments
 (0)