Skip to content

Commit f1f5588

Browse files
author
Dou Du
committed
add binder config
1 parent cca9b24 commit f1f5588

File tree

3 files changed

+92
-7
lines changed

3 files changed

+92
-7
lines changed

binder/environment.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# a mybinder.org-ready environment for demoing jupyterlab_cube
2+
# this environment may also be used locally on Linux/MacOS/Windows, e.g.
3+
#
4+
# conda env update --file binder/environment.yml
5+
# conda activate jupyterlab_cube-demo
6+
#
7+
name: widget-code-input
8+
9+
channels:
10+
- conda-forge
11+
12+
dependencies:
13+
# runtime dependencies
14+
- python >=3.9.12,<3.10
15+
- jupyterlab >=3.5.1,<4.0.0a0
16+
# labextension build dependencies
17+
- nodejs >=18,<19
18+
- yarn >=1.22
19+
- pip
20+
- wheel
21+
# additional packages for demos
22+
- pip:
23+
- ipywidgets >=8.0.3
24+
- voila >=0.4.0
25+
- voila-osscar-template

binder/postBuild

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
""" perform a development install of jupyterlab_cube
3+
4+
On Binder, this will run _after_ the environment has been fully created from
5+
the environment.yml in this directory.
6+
7+
This script should also run locally on Linux/MacOS/Windows:
8+
9+
python3 binder/postBuild
10+
"""
11+
import subprocess
12+
import sys
13+
from pathlib import Path
14+
15+
16+
ROOT = Path.cwd()
17+
18+
def _(*args, **kwargs):
19+
""" Run a command, echoing the args
20+
21+
fails hard if something goes wrong
22+
"""
23+
print("\n\t", " ".join(args), "\n")
24+
return_code = subprocess.call(args, **kwargs)
25+
if return_code != 0:
26+
print("\nERROR", return_code, " ".join(args))
27+
sys.exit(return_code)
28+
29+
# verify the environment is self-consistent before even starting
30+
_(sys.executable, "-m", "pip", "check")
31+
32+
# install the labextension
33+
_(sys.executable, "-m", "pip", "install", "-e", ".")
34+

examples/introduction.ipynb

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": null,
12+
"execution_count": 9,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
@@ -18,7 +18,7 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": null,
21+
"execution_count": 10,
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
@@ -35,16 +35,31 @@
3535
},
3636
{
3737
"cell_type": "code",
38-
"execution_count": null,
38+
"execution_count": 11,
3939
"metadata": {},
40-
"outputs": [],
40+
"outputs": [
41+
{
42+
"data": {
43+
"application/vnd.jupyter.widget-view+json": {
44+
"model_id": "f92e2cded5e044a8a2a0238018f1cac7",
45+
"version_major": 2,
46+
"version_minor": 0
47+
},
48+
"text/plain": [
49+
"WidgetCodeInput(code_theme='nord', docstring='\\n Input the docstring here.\\n ', function_body='# Give info…"
50+
]
51+
},
52+
"metadata": {},
53+
"output_type": "display_data"
54+
}
55+
],
4156
"source": [
4257
"display(w)"
4358
]
4459
},
4560
{
4661
"cell_type": "code",
47-
"execution_count": null,
62+
"execution_count": 12,
4863
"metadata": {},
4964
"outputs": [],
5065
"source": [
@@ -53,9 +68,20 @@
5368
},
5469
{
5570
"cell_type": "code",
56-
"execution_count": null,
71+
"execution_count": 13,
5772
"metadata": {},
58-
"outputs": [],
73+
"outputs": [
74+
{
75+
"data": {
76+
"text/plain": [
77+
"3"
78+
]
79+
},
80+
"execution_count": 13,
81+
"metadata": {},
82+
"output_type": "execute_result"
83+
}
84+
],
5985
"source": [
6086
"my_function(1, 2)"
6187
]

0 commit comments

Comments
 (0)