Skip to content

Commit 311f367

Browse files
authored
Merge pull request #29 from parente/jlab-3.1
Update for JupyterLab 3.1.x, latest cookiecutter
2 parents bf52fe1 + 828fede commit 311f367

File tree

18 files changed

+25071
-3941
lines changed

18 files changed

+25071
-3941
lines changed

.eslintrc.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ module.exports = {
1212
},
1313
plugins: ['@typescript-eslint'],
1414
rules: {
15-
'@typescript-eslint/interface-name-prefix': [
15+
'@typescript-eslint/naming-convention': [
1616
'error',
17-
{ prefixWithI: 'always' }
17+
{
18+
'selector': 'interface',
19+
'format': ['PascalCase'],
20+
'custom': {
21+
'regex': '^I[A-Z]',
22+
'match': true
23+
}
24+
}
1825
],
1926
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
2027
'@typescript-eslint/no-explicit-any': 'off',

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install dev dependencies
2525
run: |
2626
pip install -r requirements-dev.txt
27-
jlpm
27+
npm install
2828
- name: Build the extension
2929
run: make build
3030
- name: Lint the extension
@@ -49,7 +49,9 @@ jobs:
4949
python-version: '3.9'
5050
architecture: 'x64'
5151
- name: Install packaging dependencies
52-
run: pip install -r requirements-dev.txt
52+
run: |
53+
pip install -r requirements-dev.txt
54+
npm install
5355
- name: Package the extension
5456
run: make packages
5557
- name: Test extension install

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
**/node_modules
33
**/lib
44
**/package.json
5+
jupyterlab_quickopen

.prettierrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"singleQuote": true
2+
"singleQuote": true,
3+
"trailingComma": "none",
4+
"arrowParens": "avoid"
35
}

MANIFEST.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
include LICENSE
22
include README.md
3+
include RELEASE.md
34
include pyproject.toml
4-
include jupyter-config/jupyterlab-quickopen.json
5+
recursive-include jupyter-config *.json
56

67
include package.json
78
include install.json
89
include ts*.json
10+
include yarn.lock
911

10-
graft jupyterlab-quickopen/labextension
12+
graft jupyterlab_quickopen/labextension
1113

1214
# Javascript files
1315
graft src
1416
graft style
17+
graft schema
1518
prune **/node_modules
1619
prune lib
20+
prune binder
1721

1822
# Patterns to exclude from any directory
1923
global-exclude *~

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ check: ## Check for proper package install (not in development mode)
2020

2121
clean: ## Make a clean source tree
2222
rm -rf __pycache__ \
23+
.ipynb_checkpoints \
2324
build/ \
2425
dist/ \
2526
jupyterlab_quickopen/__pycache__ \
@@ -40,6 +41,7 @@ nuke: clean ## Make a clean source tree and nuke the venv
4041

4142
packages: ## Make source and wheel packages
4243
rm -rf dist/
44+
jlpm run build:prod
4345
python setup.py sdist bdist_wheel
4446
ls -l dist/
4547

@@ -55,7 +57,8 @@ venv: ## Make a development virtual env
5557
source ./.venv/bin/activate \
5658
&& pip install -r requirements-dev.txt \
5759
&& pip install -e . \
58-
&& jupyter labextension develop . --overwrite
60+
&& jupyter labextension develop . --overwrite \
61+
&& jupyter server extension enable jupyterlab_quickopen
5962

6063
watch: ## Watch source changes and rebuild
6164
jlpm run watch

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Quickly open a file in JupyterLab by typing part of its name
99
## Compatibility
1010

1111
- Python >=3.7.x
12-
- [JupyterLab](https://github.com/jupyterlab/jupyterlab) >=3.0,<4.0
13-
- [Jupyter Server](https://github.com/jupyter/jupyter_server) >=1.0,<2.0
12+
- [JupyterLab](https://github.com/jupyterlab/jupyterlab) >=3.1,<4.0
13+
- [Jupyter Server](https://github.com/jupyter/jupyter_server) >=1.6,<2.0
1414
- Configurations where notebook documents and other files reside on a filesystem local to the
1515
Jupyter Server (which is the the default), not remote storage (e.g., S3)
1616

@@ -119,7 +119,4 @@ Python/TypeScript tests are also required.
119119

120120
_Will this extension work with JupyterLab 2.x?_
121121

122-
Version 0.5.0 is the last revision compatible with JupyterLab 2.x. See the [README in the 0.5.0
123-
tagged commit](https://github.com/parente/jupyterlab-quickopen/tree/0.5.0) for install instructions.
124-
125-
Be aware that I do **not** backport security and bug fixes to this or older versions.
122+
Not since [version 0.5.0(https://github.com/parente/jupyterlab-quickopen/tree/0.5.0).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"NotebookApp": {
3+
"nbserver_extensions": {
4+
"jupyterlab_quickopen": true
5+
}
6+
}
7+
}

jupyterlab_quickopen/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""Registers the jupyterlab front and backend quickopen extensions"""
22
import json
3-
import os.path as osp
3+
from pathlib import Path
44

55
from ._version import __version__
66

7-
HERE = osp.abspath(osp.dirname(__file__))
7+
HERE = Path(__file__).parent.resolve()
88

9-
with open(osp.join(HERE, "labextension", "package.json")) as fid:
9+
with (HERE / "labextension" / "package.json").open() as fid:
1010
data = json.load(fid)
1111

1212

@@ -27,15 +27,15 @@ def _load_jupyter_server_extension(server_app):
2727
2828
Parameters
2929
----------
30-
lab_app: jupyterlab.labapp.LabApp
30+
server_app: jupyterlab.labapp.LabApp
3131
JupyterLab application instance
3232
"""
3333
server_app.log.debug("notebook_dir: %s", server_app.notebook_dir)
3434
server_app.log.debug(
3535
"contents_manager.root_dir: %s", server_app.contents_manager.root_dir
3636
)
3737
if (
38-
not osp.isdir(server_app.root_dir)
38+
not Path(server_app.root_dir).is_dir()
3939
or server_app.contents_manager.root_dir != server_app.root_dir
4040
):
4141
server_app.log.info(
@@ -54,3 +54,7 @@ def _load_jupyter_server_extension(server_app):
5454
f"Registered QuickOpenHandler extension at URL path {route_pattern} "
5555
f"to serve results of scanning local path {server_app.notebook_dir}"
5656
)
57+
58+
59+
# For backward compatibility with notebook server - useful for Binder/JupyterHub
60+
load_jupyter_server_extension = _load_jupyter_server_extension

0 commit comments

Comments
 (0)