Skip to content

Commit b181b5f

Browse files
Merge pull request #18 from mariobuikhuizen/binder
docs: make repo run on mybinder
2 parents 5fb0fb3 + fb0956a commit b181b5f

File tree

5 files changed

+73
-0
lines changed

5 files changed

+73
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
![Github Actions Status](https://github.com/QuantStack/jupyterlab-snippets/workflows/Build/badge.svg)
44
[![Version](https://img.shields.io/pypi/v/jupyterlab-snippets.svg)](https://pypi.python.org/project/jupyterlab-snippets)
55
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/jupyterlab-snippets.svg)](https://anaconda.org/conda-forge/jupyterlab-snippets)
6+
[![Binder](https://mybinder.org/badge_logo.svg.svg)](https://mybinder.org/v2/gh/QuantStack/jupyterlab-snippets/stable?urlpath=lab/workspaces/default)
67

78
Snippets Extension for JupyterLab.
89

binder/default.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"data":{"layout-restorer:data":{"main":{"dock":{"type":"tab-area","currentIndex":0,"widgets":["notebook:empty.ipynb"]},"mode":"multiple-document","current":"notebook:empty.ipynb"},"left":{"collapsed":false,"current":"filebrowser","widgets":["filebrowser","running-sessions","command-palette","tab-manager"]},"right":{"collapsed":true,"widgets":[]}},"notebook:empty.ipynb":{"data":{"path":"empty.ipynb","factory":"Notebook"}}},"metadata":{"id":"/lab/workspaces/default"}}

binder/empty.ipynb

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": []
9+
}
10+
],
11+
"metadata": {
12+
"kernelspec": {
13+
"display_name": "Python 3",
14+
"language": "python",
15+
"name": "python3"
16+
},
17+
"language_info": {
18+
"codemirror_mode": {
19+
"name": "ipython",
20+
"version": 3
21+
},
22+
"file_extension": ".py",
23+
"mimetype": "text/x-python",
24+
"name": "python",
25+
"nbconvert_exporter": "python",
26+
"pygments_lexer": "ipython3",
27+
"version": "3.7.6"
28+
}
29+
},
30+
"nbformat": 4,
31+
"nbformat_minor": 4
32+
}

binder/environment.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: jupyterlan-snippets
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- jupyterlab-snippets=0.3.2
6+
- jupyterlab >=2
7+
- nodejs

binder/postBuild

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# install snippets
4+
5+
cd jupyter-boilerplate-converter
6+
git clone git://github.com/moble/jupyter_boilerplate
7+
npm install
8+
9+
export SNIPPET_DIR=`python -c "from jupyter_core.paths import jupyter_path;print(jupyter_path('snippets')[0])"`
10+
11+
mkdir -p $SNIPPET_DIR
12+
13+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/astropy.js $SNIPPET_DIR .py
14+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/matplotlib.js $SNIPPET_DIR .py
15+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/numpy.js $SNIPPET_DIR .py
16+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/python.js $SNIPPET_DIR .py
17+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/scipy.js $SNIPPET_DIR .py
18+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/h5py.js $SNIPPET_DIR .py
19+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/numba.js $SNIPPET_DIR .py
20+
npm run convert ./jupyter_boilerplate/snippets_submenus_python/sympy.js $SNIPPET_DIR .py
21+
22+
cd ..
23+
24+
ln -s $SNIPPET_DIR snippets_symlink
25+
26+
# prepare Jupyter Lab
27+
28+
cp binder/empty.ipynb .
29+
jupyter lab workspaces import binder/default.json
30+
31+
jupyter lab build
32+

0 commit comments

Comments
 (0)