Skip to content
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

JupyterLab Server as Server Extension #79

Merged
merged 84 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
08ccf1f
initial working version for jupyterlab as sever extension - See also …
echarles Oct 22, 2019
e7e5422
user jupyter_server - tests need to be updated
echarles Oct 30, 2019
a5398dc
revert the .jp-Notebook in the shortcut extension definition
echarles Oct 31, 2019
c9d0b3d
add jupyter_server as deps - will need to pin the version once jupyte…
echarles Nov 7, 2019
143203d
install jupyter_server from @Zsailer branch
echarles Nov 10, 2019
f66a3db
use jupyter_server master
echarles Nov 17, 2019
1c9d80d
user master jupyter server
echarles Dec 2, 2019
0ce6400
revert the py deps
echarles Dec 2, 2019
07d0106
depends on jupyter server master
echarles Dec 2, 2019
8023f2a
dependency links
echarles Dec 4, 2019
e6ef85d
deps from git
echarles Dec 5, 2019
18a3449
more iteration to use the jupyter_server pytest plugin
echarles Jan 15, 2020
380cb03
more iteration to use the jupyter_server pytest plugin
echarles Jan 15, 2020
2a1ecce
handlers are now working fine
echarles Jan 16, 2020
8bc8ce5
extensionhandler is a mixin
echarles Feb 12, 2020
8cbed05
more tests for the settingshandler
echarles Feb 13, 2020
9a6f180
settings api test ok
echarles Feb 14, 2020
1f2aabc
test workspaces are ok
echarles Feb 14, 2020
9d9fb55
add github actions and exra_requires for test
echarles Feb 17, 2020
307ac45
convert posixpath to str for py3.5
echarles Feb 17, 2020
89c16c7
add py3.7 and 3.8 to travis
echarles Feb 17, 2020
2f3aa4b
handler loading
echarles Feb 26, 2020
f404917
jupyterlab_server pytest plugin
echarles Feb 26, 2020
f7bc7ed
rename make_lab_extension_app
echarles Feb 26, 2020
4a1bb47
add a TODO to pin to a released jupyter_server once available
echarles Feb 26, 2020
6230114
add missing import
echarles Feb 26, 2020
20323ff
ensure default mathlab_url
echarles Feb 28, 2020
6c2e388
add todo to remove cdn usage
echarles Feb 28, 2020
accd8c3
update to take https://github.com/jupyter/jupyter_server/pull/180
echarles Feb 29, 2020
7ac4405
use zach repo
echarles Feb 29, 2020
1c153cb
use zach repo
echarles Feb 29, 2020
ed83d68
Update to the latest jupyter_server.git@discover-extensionapp-config
echarles Mar 5, 2020
aa004ff
patches to support new extension loading module in jupyterlab
Zsailer Mar 6, 2020
57f9a9a
Merge pull request #1 from Zsailer/jupyter_server_patches
echarles Mar 6, 2020
7f953e9
Merge branch 'master' into jupyter_server
echarles Mar 6, 2020
1dacf6d
working tests
Zsailer Mar 10, 2020
83ff6a3
remove commented lines and fix minor bug in handlers
Zsailer Mar 10, 2020
7fcfbe5
Merge pull request #2 from Zsailer/jupyter_server_patches
echarles Mar 10, 2020
141cc41
Make examples test green
echarles Mar 19, 2020
d411fdf
ProcessApp is a server extension
echarles Mar 20, 2020
1ef00a7
ProcessApp comment
echarles Mar 21, 2020
2f79861
Order methods
echarles Mar 22, 2020
aeeb7dd
Use extension_url to align to latest jupyter server branch
echarles Apr 1, 2020
2c54d8f
Merge branch 'master' into jupyter_server
echarles Apr 8, 2020
93973f3
Fix listings
echarles Apr 8, 2020
a10d8e0
Merge branch 'master' into jupyter_server
echarles Apr 26, 2020
c0ddeed
app fixture link to server
echarles Apr 26, 2020
afaf711
use jupyter_server master
echarles Apr 27, 2020
c753dc2
user jupyter server py35 branch
echarles Apr 27, 2020
f96efa7
Remove duplicated extension_url property
echarles May 5, 2020
5200c20
Merge branch 'master' into jupyter_server
echarles May 21, 2020
0c4c544
Merge branch 'master' into jupyter_server
echarles Jun 8, 2020
d0edc2d
Use name instead of extension_name
echarles Jun 8, 2020
35a199e
listings url
echarles Jun 8, 2020
1cc0654
Use jserver extension-loadin branch
echarles Jul 29, 2020
425bc3c
Use ZSailer repo
echarles Jul 29, 2020
4c40b4b
Merge branch 'master' into jupyter_server
echarles Jul 31, 2020
5488280
renamed linking method in pytest plugin
Zsailer Jul 31, 2020
298c848
Merge pull request #3 from Zsailer/jupyter_server_patches
echarles Aug 1, 2020
9c21993
Fix more tests
echarles Aug 1, 2020
f500459
Better handlers
echarles Aug 1, 2020
6066844
Add back tree_url
echarles Aug 1, 2020
89b711c
Remove space
echarles Aug 1, 2020
545c420
Migrate transation test
echarles Aug 2, 2020
195c98d
Remove notebook deps from translation handler
echarles Aug 2, 2020
2adfe1a
Manually install branches for GitHub Actions
echarles Aug 2, 2020
e6be9b6
Fix deps for tests
echarles Aug 2, 2020
197659f
Try uninstall and install jupyter_server
echarles Aug 2, 2020
39c9c14
Try again jupyter_server deps
echarles Aug 2, 2020
34ddd99
Try to clone jupyter_server
echarles Aug 2, 2020
2cafbda
Try to clone jupyter_server
echarles Aug 2, 2020
32213f3
Remove github actions main.yml
echarles Aug 3, 2020
03b6264
relax pytest coverage
echarles Aug 3, 2020
d841d79
Use MASTER_URL_PATTERN
echarles Aug 3, 2020
ae27f6d
Remove travis.yml
echarles Aug 4, 2020
1e3feb9
Try with pip cache disablee on Github Actions
echarles Aug 4, 2020
56ba6cb
Enable temporary git clone to install jupyter_server
echarles Aug 4, 2020
fe38e36
Use _jupyter_server_extension_points
echarles Aug 4, 2020
075e965
Correct url pattern
echarles Aug 4, 2020
679b609
Depend on released jupyter_server
echarles Aug 4, 2020
5363e19
Depend on jupyter_server 1.0.0rc2
echarles Aug 4, 2020
04b5aa4
Depend on jupyter_server 1.0.0rc3
echarles Aug 4, 2020
91e06fa
Enable back the pip cache on github actions
echarles Aug 4, 2020
a052cfb
upgrade pip user
Zsailer Aug 4, 2020
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
9 changes: 5 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,20 @@ jobs:
PLATFORM: 'windows-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v1
- name: Cache pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('**/setup.py') }}
- name: Setup python
- name: Setup python ${{ matrix.PYTHON_VERSION }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.PYTHON_VERSION }}
architecture: 'x64'
- name: Install python dependencies
run: |
pip install setuptools pip --upgrade
pip install setuptools pip --upgrade --user
pip install -v -e ".[test]"
- name: Show python environment
run: |
Expand All @@ -50,7 +51,7 @@ jobs:
- name: Run python tests
# See `setup.cfg` for full test options
run: |
pytest --cov-fail-under 71
pytest
- name: Upload coverage
run: |
codecov
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest_plugins = ['pytest_jupyter_server']
8 changes: 8 additions & 0 deletions jupyterlab_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@
'SETTINGS_EXTENSION',
'WORKSPACE_EXTENSION'
]

def _jupyter_server_extension_points():
return [
{
'module': 'jupyterlab_server',
'app': LabServerApp
}
]
37 changes: 30 additions & 7 deletions jupyterlab_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,34 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import os, jinja2
from traitlets import Unicode
from jinja2 import Environment, FileSystemLoader
from traitlets import Bool, Unicode, default
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
from traitlets import Unicode, Integer, Dict

from .server import ServerApp
from ._version import __version__
from .server import url_path_join as ujoin
from .handlers import add_handlers, LabConfig


class LabServerApp(ServerApp):
class LabServerApp(ExtensionAppJinjaMixin, LabConfig, ExtensionApp):
"""A Lab Server Application that runs out-of-the-box"""
name = "jupyterlab_server"
extension_url = "/lab"
app_name = "JupyterLab Server Application"
app_version = __version__

@property
def app_namespace(self):
return self.name

default_url = Unicode('/lab',
help='The default URL to redirect to from `/`')

lab_config = LabConfig()
# Should your extension expose other server extensions when launched directly?
load_other_extensions = True

blacklist_uris = Unicode('', config=True,
help="A list of comma-separated URIs to get the blacklist")
Expand All @@ -30,9 +46,16 @@ class LabServerApp(ServerApp):
help="The optional kwargs to use for the listings HTTP requests \
as described on https://2.python-requests.org/en/v2.7.0/api/#requests.request")

def start(self):
add_handlers(self.web_app, self.lab_config)
super().start()
def initialize_templates(self):
self.static_paths = [self.static_dir]
self.template_paths = [self.templates_dir]

def initialize_settings(self):
settings = self.serverapp.web_app.settings
# By default, make terminals available.
settings.setdefault('terminals_available', True)

def initialize_handlers(self):
add_handlers(self.handlers, self)

main = LabServerApp.launch_instance
main = launch_new_instance = LabServerApp.launch_instance
Loading