-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Generate `nbgitpuller` links for your JupyterHub\n", | ||
"\n", | ||
"Below is an interactive widget that lets you compose interact links\n", | ||
"with `nbgitpuller`. In the form below, input your JupyterHub\n", | ||
"URL as well as the repository\n", | ||
"URL and information for the content you wish to share, and your interact\n", | ||
"link will be printed below." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from ipywidgets import interact\n", | ||
"\n", | ||
"@interact\n", | ||
"def make_nbgitpuller_link(hub_url='', repo_url='', branch='', subPath='', app=''):\n", | ||
" \"\"\"Generate an ipywidget form that creates an interact link.\"\"\"\n", | ||
" hub_url = hub_url.strip()\n", | ||
" kwargs = {}\n", | ||
" for name, val in [('repo', repo_url), ('branch', branch), ('subPath', subPath), ('app', app)]:\n", | ||
" if len(val) > 1:\n", | ||
" kwargs[name] = val.strip()\n", | ||
" params = f'&'.join(['{}={}'.format(nm, val) for nm, val in kwargs.items()])\n", | ||
" url = f'{hub_url}/hub/user-redirect/git-pull?{params}'\n", | ||
" if len(app) > 0 and app not in ['notebook', 'lab']:\n", | ||
" print('app must be one of [\"notebook\", \"lab\"]')\n", | ||
" elif (len(hub_url) > 0) and (len(repo_url) > 0):\n", | ||
" print(url)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.6.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
jupyter nbextension enable --py --sys-prefix appmode | ||
jupyter serverextension enable --py --sys-prefix appmode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ipywidgets | ||
appmode |