Skip to content

Commit 3c99111

Browse files
authored
Merge pull request #355 from bollwyvl/update-labextension
Update labextension build
2 parents 76ecf1f + d9aff30 commit 3c99111

File tree

9 files changed

+2489
-2041
lines changed

9 files changed

+2489
-2041
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
python-version: "${{ matrix.python-version }}"
4848

4949
- name: Build Python package
50-
id: build-package
5150
run: |
5251
pip install jupyter_packaging wheel jupyterlab
5352
python setup.py sdist bdist_wheel

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Manually added entries
22
#
3-
jsdist
4-
jupyter_server_proxy/labextension
5-
node_modules
3+
jsdist/
4+
jupyter_server_proxy/labextension/
5+
node_modules/
66
package-lock.json
7-
7+
.yarn-packages/
8+
*.tsbuildinfo
89

910

1011
# Copy pasted entries from:

CONTRIBUTING.md

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pip install -e .[test]
1414

1515
# explicit install needed with editable mode (-e) jupyter
1616
jupyter serverextension enable --sys-prefix jupyter_server_proxy
17+
jupyter server extension enable --sys-prefix jupyter_server_proxy
1718
```
1819

1920
Before running tests, you need a server that we can test against.
@@ -42,6 +43,7 @@ pip install -e .[test,acceptance]
4243
```
4344

4445
In addition, compatible versions of:
46+
4547
- `geckodriver`
4648
- `firefox`
4749

@@ -59,36 +61,24 @@ browser logs, server logs, and report HTML in `build/robot`.
5961
### JupyterLab extension
6062

6163
The `jlpm` command is JupyterLab's pinned version of `yarn` that is
62-
installed with JupyterLab. You may use `yarn` or `npm` instead of `jlpm`
63-
below.
64-
65-
```bash
66-
cd jupyterlab-server-proxy
67-
68-
# Install dependencies
69-
jlpm
70-
71-
# Build Typescript source
72-
jlpm build
64+
installed with JupyterLab.
7365

74-
# Link your development version of the extension with JupyterLab
75-
jupyter labextension link .
66+
> You may use `yarn` or `npm run` instead of `jlpm` below.
7667
77-
# Rebuild Typescript source after making changes
78-
jlpm build
79-
80-
# Rebuild JupyterLab after making any changes
81-
jupyter lab build
68+
```bash
69+
cd jupyterlab-server-proxy # Change to the root of the labextension
70+
jlpm # Install dependencies (or `npm i`)
71+
jlpm build:prod # Build:
72+
# - `jupyterlab-server-proxy/lib`
73+
# - `jupyter_server_proxy/labextension`
74+
jlpm install:extension # Symlink into `{sys.prefix}/share/jupyter/labextensions`
8275
```
8376

84-
You can watch the source directory and run JupyterLab in watch mode to
85-
watch for changes in the extension's source and automatically rebuild
86-
the extension and application.
77+
You can watch the source directory and automatically rebuild the `lib` folder:
8778

8879
```bash
89-
# Watch the source directory in another terminal tab
90-
jlpm watch
91-
92-
# Run jupyterlab in watch mode in one terminal tab
93-
jupyter lab --watch
80+
jlpm watch # ... watch the source directory in another terminal tab
9481
```
82+
83+
However, the built-in `jupyter labextension watch` does _not_ work with this repo,
84+
as the `package.json` and `setup.py` would need to be at the same level.

jupyterlab-server-proxy/.yarnrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
disable-self-update-check true
2+
ignore-optional true
3+
network-timeout "300000"
4+
registry "https://registry.npmjs.org/"
5+
yarn-offline-mirror "../build/.yarn-packages"
6+
yarn-offline-mirror-pruning true

jupyterlab-server-proxy/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2017, Data Science 8
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jupyterlab-server-proxy/README.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,39 @@
22

33
Launcher icons for proxied applications
44

5-
65
## Prerequisites
76

8-
* JupyterLab
7+
- JupyterLab >=2,<4
98

109
## Installation
1110

11+
For JupyterLab 3, use your preferred Python package manager to install `jupyter-server-proxy`:
12+
1213
```bash
13-
jupyter labextension install @jupyterlab/server-proxy
14+
pip install jupyter-server-proxy
1415
```
1516

16-
## Development
17-
18-
For a development install (requires npm version 4 or later), do the following in the repository directory:
17+
or
1918

2019
```bash
21-
npm install
22-
npm run build
23-
jupyter labextension link .
20+
conda install jupyter-server-proxy
2421
```
2522

26-
To rebuild the package and the JupyterLab app:
23+
> As a _prebuilt_ extension, it will "just work," only a simple page reload should be required
24+
> to see launcher items. However, a full restart of `jupyter_server` or `notebook` is required
25+
> to reload the `jupyter_server_proxy` serverextension which provides most of the functionality.
26+
27+
### JupyterLab 2
28+
29+
For JupyterLab 2, ensure `nodejs` is installed and available on `$PATH` and run:
2730

2831
```bash
29-
npm run build
30-
jupyter lab build
32+
jupyter labextension install @jupyterlab/server-proxy
3133
```
3234

35+
> This will cause:
36+
>
37+
> - a download of a great deal of build assets from `npmjs.org`
38+
> - a large `webpack` build that may exhaust memory and open files handles
39+
>
40+
> **Please** consider upgrading to JupyterLab 3 before reporting issues.

jupyterlab-server-proxy/package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"email": "[email protected]"
1818
},
1919
"files": [
20-
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
21-
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
20+
"LICENSE",
21+
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}"
2222
],
2323
"main": "lib/index.js",
2424
"types": "lib/index.d.ts",
@@ -28,29 +28,33 @@
2828
},
2929
"scripts": {
3030
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
31-
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
31+
"build:prod": "jlpm clean && jlpm run build:lib && jlpm run build:labextension",
3232
"build:labextension": "jupyter labextension build .",
3333
"build:labextension:dev": "jupyter labextension build --development True .",
34-
"build:lib": "tsc",
34+
"build:lib": "tsc -b",
3535
"clean": "jlpm run clean:lib",
3636
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
3737
"clean:labextension": "rimraf jupyter_server_proxy/labextension",
3838
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
39-
"eslint": "eslint . --ext .ts,.tsx --fix",
40-
"eslint:check": "eslint . --ext .ts,.tsx",
4139
"install:extension": "jupyter labextension develop --overwrite .",
4240
"watch": "run-p watch:src watch:labextension",
43-
"watch:src": "tsc -w",
44-
"watch:labextension": "jupyter labextension watch ."
41+
"watch:src": "jlpm build:lib -w",
42+
"watch:labextension": "jupyter labextension watch .",
43+
"deduplicate": "yarn-deduplicate -s fewer --fail"
4544
},
4645
"dependencies": {
4746
"@jupyterlab/application": "^2.0 || ^3.0",
4847
"@jupyterlab/launcher": "^2.0 || ^3.0"
4948
},
49+
"resolutions": {
50+
"loader-utils": ">=2.0.3"
51+
},
5052
"devDependencies": {
5153
"@jupyterlab/builder": "^3.2.4",
52-
"rimraf": "^2.6.1",
53-
"typescript": "~3.7.0"
54+
"rimraf": "^3.0.2",
55+
"typescript": "~4.8.4",
56+
"yarn-deduplicate": "^6.0.0",
57+
"npm-run-all": "^4.1.5"
5458
},
5559
"jupyterlab": {
5660
"extension": true,

jupyterlab-server-proxy/tsconfig.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
{
22
"compilerOptions": {
33
"allowSyntheticDefaultImports": true,
4+
"composite": true,
45
"declaration": true,
5-
"lib": ["es2015", "dom"],
6-
"module": "commonjs",
6+
"esModuleInterop": true,
7+
"incremental": true,
8+
"jsx": "react",
9+
"module": "esnext",
710
"moduleResolution": "node",
811
"noEmitOnError": true,
12+
"noImplicitAny": true,
913
"noUnusedLocals": true,
10-
"outDir": "lib",
11-
"rootDir": "src",
14+
"preserveWatchOutput": true,
15+
"resolveJsonModule": true,
16+
"skipLibCheck": true,
1217
"strict": true,
13-
"strictNullChecks": false,
14-
"target": "es2015",
18+
"strictNullChecks": true,
19+
"target": "es2019",
20+
"outDir": "./lib",
21+
"rootDir": "./src",
1522
"types": []
1623
},
1724
"include": ["src/*"]

0 commit comments

Comments
 (0)