Skip to content

Update for JupyterLab 3.1.x, latest cookiecutter #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ module.exports = {
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/interface-name-prefix': [
'@typescript-eslint/naming-convention': [
'error',
{ prefixWithI: 'always' }
{
'selector': 'interface',
'format': ['PascalCase'],
'custom': {
'regex': '^I[A-Z]',
'match': true
}
}
],
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install dev dependencies
run: |
pip install -r requirements-dev.txt
jlpm
npm install
- name: Build the extension
run: make build
- name: Lint the extension
Expand All @@ -49,7 +49,9 @@ jobs:
python-version: '3.9'
architecture: 'x64'
- name: Install packaging dependencies
run: pip install -r requirements-dev.txt
run: |
pip install -r requirements-dev.txt
npm install
- name: Package the extension
run: make packages
- name: Test extension install
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
**/node_modules
**/lib
**/package.json
jupyterlab_quickopen
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"singleQuote": true
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
8 changes: 6 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
include LICENSE
include README.md
include RELEASE.md
include pyproject.toml
include jupyter-config/jupyterlab-quickopen.json
recursive-include jupyter-config *.json

include package.json
include install.json
include ts*.json
include yarn.lock

graft jupyterlab-quickopen/labextension
graft jupyterlab_quickopen/labextension

# Javascript files
graft src
graft style
graft schema
prune **/node_modules
prune lib
prune binder

# Patterns to exclude from any directory
global-exclude *~
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ check: ## Check for proper package install (not in development mode)

clean: ## Make a clean source tree
rm -rf __pycache__ \
.ipynb_checkpoints \
build/ \
dist/ \
jupyterlab_quickopen/__pycache__ \
Expand All @@ -40,6 +41,7 @@ nuke: clean ## Make a clean source tree and nuke the venv

packages: ## Make source and wheel packages
rm -rf dist/
jlpm run build:prod
python setup.py sdist bdist_wheel
ls -l dist/

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

watch: ## Watch source changes and rebuild
jlpm run watch
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Quickly open a file in JupyterLab by typing part of its name
## Compatibility

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

Expand Down Expand Up @@ -119,7 +119,4 @@ Python/TypeScript tests are also required.

_Will this extension work with JupyterLab 2.x?_

Version 0.5.0 is the last revision compatible with JupyterLab 2.x. See the [README in the 0.5.0
tagged commit](https://github.com/parente/jupyterlab-quickopen/tree/0.5.0) for install instructions.

Be aware that I do **not** backport security and bug fixes to this or older versions.
Not since [version 0.5.0(https://github.com/parente/jupyterlab-quickopen/tree/0.5.0).
7 changes: 7 additions & 0 deletions jupyter-config/nb-config/jupyterlab_quickopen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"jupyterlab_quickopen": true
}
}
}
14 changes: 9 additions & 5 deletions jupyterlab_quickopen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Registers the jupyterlab front and backend quickopen extensions"""
import json
import os.path as osp
from pathlib import Path

from ._version import __version__

HERE = osp.abspath(osp.dirname(__file__))
HERE = Path(__file__).parent.resolve()

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


Expand All @@ -27,15 +27,15 @@ def _load_jupyter_server_extension(server_app):

Parameters
----------
lab_app: jupyterlab.labapp.LabApp
server_app: jupyterlab.labapp.LabApp
JupyterLab application instance
"""
server_app.log.debug("notebook_dir: %s", server_app.notebook_dir)
server_app.log.debug(
"contents_manager.root_dir: %s", server_app.contents_manager.root_dir
)
if (
not osp.isdir(server_app.root_dir)
not Path(server_app.root_dir).is_dir()
or server_app.contents_manager.root_dir != server_app.root_dir
):
server_app.log.info(
Expand All @@ -54,3 +54,7 @@ def _load_jupyter_server_extension(server_app):
f"Registered QuickOpenHandler extension at URL path {route_pattern} "
f"to serve results of scanning local path {server_app.notebook_dir}"
)


# For backward compatibility with notebook server - useful for Binder/JupyterHub
load_jupyter_server_extension = _load_jupyter_server_extension
Loading