Skip to content

Commit ff8348f

Browse files
committed
#70: clean up some dependencies
1 parent f1d9a31 commit ff8348f

File tree

6 files changed

+42
-23
lines changed

6 files changed

+42
-23
lines changed

py_src/jupyter_lsp/CONTRIBUTING.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,22 @@ conda env update -n jupyterlab-lsp --file environment-atest.yml
165165
pip install -r requirements-atest.txt # ... and install geckodriver, somehow
166166
```
167167

168-
> Also ensure you've `jupyter labextension install .`ed in the root of the repo
168+
> To use with `jupyterlab-lsp` in JupyterLab, ensure you've
169+
>
170+
> ```
171+
> jlpm
172+
> jlpm build
173+
> jupyter labextension install .
174+
> ```
175+
176+
````
177+
> in the root of this repo. See the [README](../../README.md#development) for more
169178
170179
Run the tests:
171180
172181
```bash
173182
python scripts/atest.py
174-
```
183+
````
175184
176185
### Formatting
177186

py_src/jupyter_lsp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
> `notebook` or `lab` server. For Python 3.5+.
55
66
See the parent of this repository, [jupyterlab-lsp](../../README.md) for the
7-
reference client implementation for [JupyterLab][]
7+
reference client implementation for [JupyterLab][].
88

99
## batteries expected
1010

py_src/jupyter_lsp/types.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
""" API used by spec finders and manager
22
"""
3-
import os
43
import pathlib
54
import shutil
65
import sys
76
from typing import Callable, Dict, List, Text
87

9-
from jupyterlab.commands import get_app_dir
108
from notebook.transutils import _
119
from traitlets import List as List_, Unicode, default
1210
from traitlets.config import LoggingConfigurable
@@ -58,20 +56,32 @@ def _default_nodejs(self):
5856

5957
@default("node_roots")
6058
def _default_node_roots(self):
61-
""" get the "usual suspects" for where node_modules may be found
59+
""" get the "usual suspects" for where `node_modules` may be found
6260
6361
- where this was launch (usually the same as NotebookApp.notebook_dir)
64-
- the JupyterLab staging folder
62+
- the JupyterLab staging folder (if available)
6563
- wherever conda puts it
6664
- wherever some other conventions put it
6765
"""
68-
return [
69-
os.getcwd(),
70-
pathlib.Path(get_app_dir()) / "staging",
71-
pathlib.Path(sys.prefix) / "lib",
72-
# TODO: "well-known" windows paths
73-
sys.prefix,
74-
]
66+
67+
# check where the server was started first
68+
roots = [pathlib.Path.cwd()]
69+
70+
# try jupyterlab staging next
71+
try:
72+
from jupyterlab import commands
73+
74+
roots += [pathlib.Path(commands.get_app_dir()) / "staging"]
75+
except ImportError: # pragma: no cover
76+
pass
77+
78+
# conda puts stuff in $PREFIX/lib on POSIX systems
79+
roots += [pathlib.Path(sys.prefix) / "lib"]
80+
81+
# ... but right in %PREFIX% on nt
82+
roots += [pathlib.Path(sys.prefix)]
83+
84+
return roots
7585

7686

7787
# Gotta be down here so it can by typed... really should have a IL

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# development dependencies for jupyter_lsp for qa
1+
# development dependencies for jupyter_lsp for qa, with lab
22
-r requirements-utest.txt
33
pyls-black
44
pyls-isort
55
pyls-mypy
66
pytest-cov
7+
jupyterlab >=1.1,<1.2

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# what is needed to run jupyter_lsp (but no servers)
2-
jupyterlab>=1.1,<1.2
1+
# what is needed to run jupyter_lsp (but no servers or lab)
2+
notebook
33
setuptools

setup.cfg

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ classifiers =
2121
Programming Language :: Python
2222

2323
[options]
24-
install_requires =
25-
notebook
2624
package_dir =
2725
= py_src
26+
2827
packages = find:
2928
include_package_data = True
3029
zip_safe = False
3130

32-
tests_require =
33-
pytest
34-
pytest-cov
31+
install_requires =
32+
notebook
33+
entrypoints
3534

3635
[options.packages.find]
3736
where =
@@ -42,7 +41,7 @@ jupyter_lsp_spec_v0 =
4241
bash-language-server = jupyter_lsp.specs:bash
4342
dockerfile-language-server-nodejs = jupyter_lsp.specs:dockerfile
4443
javascript-typescript-langserver = jupyter_lsp.specs:ts
45-
pyls = jupyter_lsp.specs:py
44+
python-language-server = jupyter_lsp.specs:py
4645
unified-language-server = jupyter_lsp.specs:md
4746
vscode-css-languageserver-bin = jupyter_lsp.specs:css
4847
vscode-html-languageserver-bin = jupyter_lsp.specs:html

0 commit comments

Comments
 (0)