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

Improve Binder and launch jupyverse directly #76

Merged
merged 3 commits into from
Sep 24, 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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![Build Status](https://github.com/jupyter-server/jupyverse/workflows/CI/badge.svg)](https://github.com/jupyter-server/jupyverse/actions)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-server/jupyverse/HEAD?filepath=examples%2Fjupyverse.ipynb)

# jupyverse

Expand All @@ -9,6 +8,10 @@

A set of [FPS](https://github.com/jupyter-server/fps) plugins implementing a Jupyter server.

Try it online:
- JupyterLab frontend: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-server/jupyverse/HEAD?urlpath=jupyverse-jlab)
- RetroLab frontend: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-server/jupyverse/HEAD?urlpath=jupyverse-rlab)


## Motivation for Experimental Server

Expand Down
4 changes: 1 addition & 3 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ channels:
- conda-forge
dependencies:
- python =3.9
- jupyterlab =3
- ipyurl
- jupyter-server-proxy >=1.5
- jupyter-server-proxy
- pip
43 changes: 43 additions & 0 deletions binder/jupyter_notebook_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
jupyverse_jlab_command = ' '.join([
'jupyverse',
'--no-open-browser',
'--authenticator.mode=noauth',
'--RetroLab.enabled=false',
'--JupyterLab.collaborative',
'--JupyterLab.base_url={base_url}jupyverse-jlab/',
'--port={port}',
] + ['>jupyverse_jlab.log 2>&1'])


jupyverse_rlab_command = ' '.join([
'jupyverse',
'--no-open-browser',
'--authenticator.mode=noauth',
'--JupyterLab.enabled=false',
'--RetroLab.collaborative',
'--RetroLab.base_url={base_url}jupyverse-rlab/',
'--port={port}',
] + ['>jupyverse_rlab.log 2>&1'])


c.ServerProxy.servers = {
'jupyverse-jlab': {
'command': [
'/bin/bash', '-c', jupyverse_jlab_command
],
'timeout': 60,
'absolute_url': False
},
'jupyverse-rlab': {
'command': [
'/bin/bash', '-c', jupyverse_rlab_command
],
'timeout': 60,
'absolute_url': False
},
}

c.NotebookApp.default_url = '/jupyverse-jlab'

import logging
c.NotebookApp.log_level = logging.DEBUG
13 changes: 9 additions & 4 deletions binder/postBuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/bash

python -m pip install git+https://github.com/jupyter-server/fps
python -m pip install fps-uvicorn==0.0.2
mkdir fps \
&& wget -q https://github.com/jupyter-server/fps/archive/master.tar.gz -O - \
| tar xz -C fps --strip-components=1 \
&& cd fps \
&& python -m pip install . \
&& python -m pip install plugins/uvicorn \
&& cd .. \
&& rm -rf fps

python -m pip install .[jupyterlab] --no-deps
python -m pip install plugins/jupyterlab
python -m pip install plugins/retrolab
Expand All @@ -11,5 +18,3 @@ python -m pip install plugins/terminals
python -m pip install plugins/nbconvert
python -m pip install plugins/yjs
python -m pip install plugins/auth

jupyter serverextension enable --sys-prefix jupyter_server_proxy
12 changes: 12 additions & 0 deletions binder/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
import sys
import shutil
import os

argv = sys.argv[1:] + ['--config', 'binder/jupyter_notebook_config.py']
print(argv)

with open('startup_args.txt', 'w') as fid:
fid.write(str(argv))

os.execv(shutil.which(argv[0]), argv)
104 changes: 0 additions & 104 deletions examples/jupyverse.ipynb

This file was deleted.

3 changes: 1 addition & 2 deletions plugins/jupyterlab/fps_jupyterlab/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from typing import Optional

from babel import Locale # type: ignore
from pydantic import UUID4
import jupyterlab # type: ignore
import jupyverse # type: ignore
from fastapi import APIRouter, Response, Depends, status
Expand Down Expand Up @@ -72,7 +71,7 @@
@router.get("/")
async def get_root(
response: Response,
token: Optional[UUID4] = None,
token: Optional[str] = None,
auth_config=Depends(get_auth_config),
jlab_config=Depends(get_jlab_config),
user_db=Depends(get_user_db),
Expand Down
3 changes: 1 addition & 2 deletions plugins/retrolab/fps_retrolab/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from typing import Optional

from babel import Locale # type: ignore
from pydantic import UUID4
from starlette.requests import Request # type: ignore
from fps.hooks import register_router # type: ignore
import retrolab # type: ignore
Expand Down Expand Up @@ -88,7 +87,7 @@
@router.get("/")
async def get_root(
response: Response,
token: Optional[UUID4] = None,
token: Optional[str] = None,
auth_config=Depends(get_auth_config),
rlab_config=Depends(get_rlab_config),
user_db=Depends(get_user_db),
Expand Down