Skip to content

Commit 36aa77c

Browse files
committed
serverextension setup
1 parent c0b0d7b commit 36aa77c

File tree

5 files changed

+37
-13
lines changed

5 files changed

+37
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.ipynb_checkpoints/
12
*.bundle.*
23
dist/
34
jupyterlab_latex.egg-info/

.prettierignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
node_modules
2-
**/lib
1+
**/lib/
2+
dist/
3+
jupyterlab_latex/labextension/
4+
node_modules/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
| [![ci-badge]][ci] | [![binder-badge]][binder-stable] | [![binder-badge]][binder-latest] |
66

77
[ci-badge]: https://github.com/jupyterlab/jupyterlab-latex/actions/workflows/build.yml/badge.svg
8-
[ci]: https://github.com/jupyterlab/jupyterlab-latex/actions/workflows/build.yml?query=branch%3Amaster
8+
[ci]: https://github.com/jupyterlab/jupyterlab-latex/actions/workflows/build.yml?query=branch/master
99
[binder-badge]: https://mybinder.org/badge_logo.svg
10-
[binder-stable]: https://mybinder.org/v2/gh/jupyterlab/jupyterlab-latex.git/3.0.0?urlpath=lab%2Ftree%2Fsample.tex
11-
[binder-latest]: https://mybinder.org/v2/gh/jupyterlab/jupyterlab-latex.git/master?urlpath=lab%2Ftree%2Fsample.tex
10+
[binder-stable]: https://mybinder.org/v2/gh/jupyterlab/jupyterlab-latex.git/3.0.0?urlpath=lab/tree/sample.tex
11+
[binder-latest]: https://mybinder.org/v2/gh/jupyterlab/jupyterlab-latex.git/master?urlpath=lab/tree/sample.tex
1212

1313
An extension for JupyterLab which allows for live-editing of LaTeX documents.
1414

binder/postBuild

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ set -eux
33

44
jlpm --ignore-optional
55
jlpm build
6+
67
python -m pip install -e . --no-deps --ignore-installed --no-build-isolation
7-
jupyter labextension develop --overwrite .
88

9+
jupyter serverextension enable --sys-prefix --py jupyterlab_latex
10+
jupyter serverextension list
11+
12+
jupyter server extension enable --sys-prefix --py jupyterlab_latex
13+
jupyter server extension list
14+
15+
jupyter labextension develop --overwrite .
916
jupyter labextension list

jupyterlab_latex/__init__.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
""" JupyterLab LaTex : live LaTeX editing for JupyterLab """
2-
3-
import json
4-
from pathlib import Path
5-
from notebook.utils import url_path_join
6-
72
from ._version import __version__, __js__
8-
from .build import LatexBuildHandler
9-
from .synctex import LatexSynctexHandler
3+
4+
__all__ = [
5+
"__js__",
6+
"__version__",
7+
"_jupyter_labextension_paths",
8+
"_jupyter_server_extension_paths",
9+
"_jupyter_server_extension_points",
10+
"_load_jupyter_server_extension",
11+
"load_jupyter_server_extension",
12+
]
1013

1114
path_regex = r'(?P<path>(?:(?:/[^/]+)+|/?))'
1215

16+
17+
1318
def _jupyter_labextension_paths():
1419
return [{
1520
"src": "labextension",
@@ -21,13 +26,20 @@ def _jupyter_server_extension_points():
2126
'module': 'jupyterlab_latex'
2227
}]
2328

29+
_jupyter_server_extension_paths = _jupyter_server_extension_points
30+
2431
def load_jupyter_server_extension(nb_server_app):
2532
"""
2633
Called when the extension is loaded.
2734
2835
Args:
2936
nb_server_app (NotebookApp): handle to the Notebook webserver instance.
3037
"""
38+
from notebook.utils import url_path_join
39+
40+
from .build import LatexBuildHandler
41+
from .synctex import LatexSynctexHandler
42+
3143
web_app = nb_server_app.web_app
3244
# Prepend the base_url so that it works in a jupyterhub setting
3345
base_url = web_app.settings['base_url']
@@ -44,3 +56,5 @@ def load_jupyter_server_extension(nb_server_app):
4456
{"notebook_dir": nb_server_app.notebook_dir}
4557
)]
4658
web_app.add_handlers('.*$', handlers)
59+
60+
_load_jupyter_server_extension = load_jupyter_server_extension

0 commit comments

Comments
 (0)