Skip to content

Commit 3242e2b

Browse files
authored
Merge pull request #71 from bollwyvl/gh-70-remove-hard-lab-dependency
Remove hard lab dependency
2 parents cb22a4e + 8c7d4ab commit 3242e2b

File tree

10 files changed

+74
-32
lines changed

10 files changed

+74
-32
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,37 @@ jupyter labextension install @krassowski/jupyterlab-lsp@0.5.0-rc.0
156156

157157
## Development
158158

159-
For a development install (requires npm version 4 or later), do the following in the repository directory:
159+
For a development install (requires `nodejs` 8 or later and `jupyterlab` 1.1),
160+
run the following in the repository directory:
160161

161162
```bash
162-
npm install
163-
npm run build
164-
jupyter labextension link .
163+
jlpm
164+
jlpm build
165+
jupyter labextension install .
165166
```
166167

167168
To rebuild the package and the JupyterLab app:
168169

169170
```bash
170-
npm run build
171+
jlpm build
171172
jupyter lab build
172173
```
173174

174-
To run tests suite:
175+
To watch the files and build continuously:
175176

176177
```bash
177-
npm test
178+
jlpm watch # leave this running...
179+
jupyter lab --watch # ...in another terminal
180+
```
181+
182+
To check and fix code style:
183+
184+
```bash
185+
jlpm lint
186+
```
187+
188+
To run test the suite:
189+
190+
```bash
191+
jlpm test
178192
```

py_src/jupyter_lsp/CONTRIBUTING.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ python scripts/utest.py
157157

158158
### Browser-based Acceptance Tests
159159

160+
The browser tests will launch JupyterLab on a random port and exercise the
161+
Language Server features with [Robot Framework][] and [SeleniumLibrary][].
162+
163+
[robot framework]: https://github.com/robotframework/robotframework
164+
[seleniumlibrary]: https://github.com/robotframework/seleniumlibrary
165+
166+
First, ensure you've prepared JupyterLab for `jupyterlab-lsp`
167+
[development](../../README.md#development).
168+
160169
Prepare the enviroment:
161170

162171
```bash
@@ -165,14 +174,21 @@ conda env update -n jupyterlab-lsp --file environment-atest.yml
165174
pip install -r requirements-atest.txt # ... and install geckodriver, somehow
166175
```
167176

168-
> Also ensure you've `jupyter labextension install .`ed in the root of the repo
169-
170177
Run the tests:
171178

172179
```bash
173180
python scripts/atest.py
174181
```
175182

183+
The Robot Framework reports and screenshots will be in `atest/output`, with
184+
`<operating system>_<python version>.log.html` being the most interesting
185+
artifacts, e.g.
186+
187+
```
188+
- linux_37.log.html
189+
- linux_37.report.html
190+
```
191+
176192
### Formatting
177193

178194
Minimal code style is enforced with `flake8` during unit testing. If installed,

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-atest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# acceptance test dependencies for jupyter_lsp
2-
-r requirements.txt
2+
-r requirements-lab.txt
33
robotframework-seleniumlibrary

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

requirements-lab.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# the version of jupyterlab
2+
-r requirements.txt
3+
jupyterlab >=1.1,<1.2

requirements-utest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# test time dependencies for jupyter_lsp, including one language server
2-
-r requirements.txt
2+
-r requirements-lab.txt
33
flake8 >=3.5
44
pytest-asyncio
55
pytest-cov

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)