diff --git a/README.md b/README.md index f55cc9be..816bf2d6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![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) +[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-server/jupyverse/HEAD # jupyverse diff --git a/binder/environment.yml b/binder/environment.yml index da378281..3372caf6 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -3,7 +3,5 @@ channels: - conda-forge dependencies: - python =3.9 - - jupyterlab =3 - - ipyurl - - jupyter-server-proxy >=1.5 + - jupyter-server-proxy - pip diff --git a/binder/jupyter_notebook_config.py b/binder/jupyter_notebook_config.py new file mode 100644 index 00000000..2a80d2e2 --- /dev/null +++ b/binder/jupyter_notebook_config.py @@ -0,0 +1,24 @@ +jupyverse_command = ' '.join([ + 'jupyverse', + '--no-open-browser', + '--authenticator.mode=noauth', + '--JupyterLab.collaborative', + '--JupyterLab.base_url={base_url}jupyverse/', + '--port={port}', +] + ['>jupyverse.log 2>&1']) + + +c.ServerProxy.servers = { + 'jupyverse': { + 'command': [ + '/bin/bash', '-c', jupyverse_command + ], + 'timeout': 60, + 'absolute_url': False + }, +} + +c.NotebookApp.default_url = '/jupyverse' + +import logging +c.NotebookApp.log_level = logging.DEBUG diff --git a/binder/postBuild b/binder/postBuild index 3cd50084..0771a553 100644 --- a/binder/postBuild +++ b/binder/postBuild @@ -1,15 +1,19 @@ #!/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/davidbrochart/fps/archive/root_path.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 python -m pip install plugins/contents python -m pip install plugins/kernels 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 diff --git a/binder/start b/binder/start new file mode 100644 index 00000000..067b064f --- /dev/null +++ b/binder/start @@ -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) diff --git a/examples/jupyverse.ipynb b/examples/jupyverse.ipynb deleted file mode 100644 index 528d1d62..00000000 --- a/examples/jupyverse.ipynb +++ /dev/null @@ -1,104 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "4f2dbabd-a61c-4426-9f40-6a02cb511300", - "metadata": {}, - "outputs": [], - "source": [ - "from ipyurl import Url" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "54f24cbd-19b0-4259-b26a-6c4ca2f0b57d", - "metadata": {}, - "outputs": [], - "source": [ - "w = Url()\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "acbef777-b9f4-40d4-b6f3-bfbb9ad8144e", - "metadata": {}, - "outputs": [], - "source": [ - "user_id = w.url.split(\"/user/\", 1)[1].strip(\"/\")\n", - "host = \"127.0.0.1\"\n", - "port = \"8005\"" - ] - }, - { - "cell_type": "markdown", - "id": "f960a732-a0f3-4ca3-8eef-f0718c0c071e", - "metadata": {}, - "source": [ - "Choose the frontend in the following cell:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "939505c7-4861-4095-9393-6c89c13baaee", - "metadata": {}, - "outputs": [], - "source": [ - "frontend = \"jupyterlab\"\n", - "#frontend = \"retrolab\"\n", - "\n", - "if frontend == \"retrolab\":\n", - " jlab_enabled = \"false\"\n", - " rlab_enabled = \"true\"\n", - "else:\n", - " jlab_enabled = \"true\"\n", - " rlab_enabled = \"false\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ba2190b9-ccb7-4150-b223-f2145f223864", - "metadata": {}, - "outputs": [], - "source": [ - "print(f\"Execute the following cell and then open this URL: {w.url.strip('/')}/proxy/{host}:{port}/\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0c3150eb-c701-4ffa-974f-91b7ad2464c0", - "metadata": {}, - "outputs": [], - "source": [ - "!jupyverse --no-open-browser --authenticator.mode=noauth --JupyterLab.collaborative=true --RetroLab.collaborative=true --JupyterLab.enabled={jlab_enabled} --RetroLab.enabled={rlab_enabled} --JupyterLab.base_url=/user/{user_id}/proxy/{host}:{port}/ --RetroLab.base_url=/user/{user_id}/proxy/{host}:{port}/ --port={port}" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.7" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}