Skip to content

Commit bc53101

Browse files
committed
Initial implementation
0 parents  commit bc53101

27 files changed

+3789
-0
lines changed

.coveragerc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[run]
2+
source=jupyterlab_quickopen
3+
[report]
4+
omit =
5+
*/python?.?/*
6+
*test*
7+
# ignore _version.py and versioneer.py
8+
.*version.*
9+
*_version.py

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 100

.gitignore

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
5+
# C extensions
6+
*.so
7+
8+
# Distribution / packaging
9+
.Python
10+
env/
11+
bin/
12+
build/
13+
develop-eggs/
14+
dist/
15+
eggs/
16+
lib/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
doc/_build
25+
26+
# Installer logs
27+
pip-log.txt
28+
pip-delete-this-directory.txt
29+
30+
# Unit test / coverage reports
31+
htmlcov/
32+
.tox/
33+
cover/
34+
.coverage
35+
.cache
36+
nosetests.xml
37+
coverage.xml
38+
cover/
39+
40+
# Translations
41+
*.mo
42+
43+
# Mr Developer
44+
.mr.developer.cfg
45+
.project
46+
.pydevproject
47+
48+
# Rope
49+
.ropeproject
50+
51+
# Django stuff:
52+
*.log
53+
*.pot
54+
55+
# Sphinx documentation
56+
docs/_build/
57+
58+
#mac
59+
.DS_Store
60+
*~
61+
62+
#pycharm
63+
.idea/*
64+
65+
#Dolphin browser files
66+
.directory/
67+
.directory
68+
69+
#Binary data files
70+
*.volume
71+
*.am
72+
*.tiff
73+
*.tif
74+
*.dat
75+
*.DAT
76+
77+
#generated documntation files
78+
generated/
79+
80+
#ipython notebook
81+
.ipynb_checkpoints/
82+
83+
#vim
84+
*.swp
85+
86+
#data files
87+
*.zip
88+
*.jpg
89+
90+
# ctags
91+
.tags*
92+
93+
# VSCode
94+
.vscode/
95+
96+
# Node
97+
node_modules/

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: python
2+
python:
3+
- '3.6'
4+
install:
5+
- pip install -r requirements.txt -r requirements-test.txt
6+
script:
7+
- make pytest
8+
- make jstest

LICENSE

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

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include versioneer.py
2+
include jupyterlab_quickopen/_version.py
3+
recursive-include config *.json

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
SHELL:=bash
2+
PKG_SLUG:=jupyterlab-quickopen
3+
PKG_NAME:=jupyterlab_quickopen
4+
CONDA_ENV:=jupyterlab-ext2
5+
6+
help:
7+
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
8+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
9+
10+
clean: ## Make a clean source tree
11+
-find . -name '*.pyc' -exec rm -fv {} \;
12+
rm -rf $(PKG_NAME)/__pycache__ __pycache__
13+
rm -rf *.egg-info
14+
rm -rf node_modules
15+
rm -rf lib
16+
17+
activate: ## Make a conda activation command for eval
18+
@echo "source activate $(PKG_SLUG)"
19+
20+
conda-env: ## Make a conda development environment
21+
conda create -n $(PKG_SLUG) -c conda-forge python=3 \
22+
--file requirements.txt --file requirements-dev.txt
23+
source activate $(PKG_SLUG) && \
24+
jlpm install && \
25+
jupyter labextension install . --no-build
26+
source activate $(PKG_SLUG) && \
27+
pip install -e . && \
28+
jupyter serverextension enable $(PKG_NAME)
29+
30+
release: ## Make a release on PyPI and npmjs.org
31+
# python setup.py sdist register upload
32+
# npm upload
33+
34+
watch-lab: ## Make a JupyterLab build process watch for extension builds
35+
source activate $(PKG_SLUG) && jupyter lab --watch
36+
37+
watch-src: ## Make a TypeScript build process watch for source changes
38+
source activate $(PKG_SLUG) && jlpm run watch

README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# jupyterlab-quickopen
2+
3+
Quickly open a file in JupyterLab by typing part of its name
4+
5+
![Animation showing entering partial filenames in the quick open sidebar and the corresponding file editor opening](./doc/quickopen.gif)
6+
7+
## Compatibility
8+
9+
* JupyterLab 0.35.x
10+
* Jupyter Notebook >=5.2.x
11+
* Notebook server configurations where notebook documents and other files reside
12+
on the local filesystem (which is the the notebook server default)
13+
14+
## Install
15+
16+
Install the Jupyter Notebook server extension under `PREFIX` (e.g., the active
17+
virtualenv or conda env).
18+
19+
```
20+
pip install jupyterlab-quickopen
21+
```
22+
23+
Then install the JupyterLab frontend extension.
24+
25+
```
26+
jlpm install @parente/jupyterlab-quickopen
27+
```
28+
29+
### Install Alternatives
30+
31+
You can use `jupyter serverextension` commands to enable and disable the
32+
server extension in different contexts, e.g.:
33+
34+
```
35+
jupyter serverextension enable --py jupyterlab_quickopen --user
36+
jupyter serverextension disable --py jupyterlab_quickopen --sys-prefix
37+
```
38+
39+
## Configure
40+
41+
### A Keyboard Shortcut
42+
43+
You can assign a keyboard shortcut to show the quickopen panel at any time. Open
44+
the keyboard editor by clicking *Settings → Advanced Settings Editor
45+
→ Keyboard Shortcuts*. Then enter JSON in the *User Overrides* text area
46+
like the following, adjusting the `keys` value to assign the shortcut of your
47+
choosing:
48+
49+
```
50+
{
51+
"quickopen:activate": {
52+
"command": "quickopen:activate",
53+
"keys": [
54+
"Accel Ctrl P"
55+
],
56+
"selector": "body",
57+
"title": "Activate Quick Open",
58+
"category": "Main Area"
59+
}
60+
}
61+
```
62+
63+
### Patterns to Exclude
64+
65+
You can control which files to exclude from the quick open list using
66+
Notebook server settings, JupyterLab settings, or both.
67+
68+
On the server side, use the `ContentsManager.allow_hidden`
69+
and/or `ContentsManager.hide_globs` settings. See the
70+
[documentation about Jupyter Notebook options](https://jupyter-notebook.readthedocs.io/en/stable/config.html)
71+
for details.
72+
73+
In the JupyterLab web app, open the *Settings* menu, click the *Advanced
74+
Settings Editor* option, select the *Quick Open* item in the *Raw View* sidebar,
75+
and enter JSON in the *User Overrides* text area to override the default
76+
values.
77+
78+
![Screenshot of the quick open settings editor](./doc/settings.png)
79+
80+
## Develop
81+
82+
The project includes a Makefile which makes setting up a development environment
83+
using `conda` easy.
84+
85+
```
86+
# Create a conda environment and install the lab/server extensions
87+
make conda-env
88+
89+
# In one terminal, watch the frontend extension source for changes and rebuild
90+
# the extension package
91+
make watch-src
92+
93+
# In a second terminal, watch for rebuilt extension packages and rebuild
94+
# jupyterlab to include them
95+
make watch-lab
96+
```
97+
98+
Keep an eye on the terminal running `watch-src` for TypeScript build errors.
99+
Keep an eye on the terminal running `watch-lab` to know when to refresh your
100+
browser. Quit and re-run the `make watch-lab` command any time you make
101+
changes to the **server** extension.

config/jupyterlab_quickopen.json

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+
}

doc/quickopen.gif

202 KB
Loading

0 commit comments

Comments
 (0)