Skip to content

Commit d55b361

Browse files
authored
Binder link (#106)
1 parent 23d1db5 commit d55b361

File tree

4 files changed

+27
-46
lines changed

4 files changed

+27
-46
lines changed

binder/environment.yml

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
# a mybinder.org-ready environment for demoing gluepyter
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 gluepyter-demo
6-
#
7-
name: gluepyter-demo
8-
1+
name: base
92
channels:
103
- conda-forge
11-
124
dependencies:
135
# runtime dependencies
14-
- python >=3.10,<3.11.0a0
6+
- python >=3.9,<3.10.0a0
7+
- nodejs >=16,<17
8+
- yarn
9+
10+
# Dependencies
1511
- jupyterlab >=4.0.0,<5
16-
# labextension build dependencies
17-
- nodejs >=18,<19
18-
- pip
19-
- wheel
20-
# additional packages for demos
21-
# - ipywidgets

binder/jupyter_config.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"LabApp": {
3+
"collaborative": true
4+
}
5+
}

binder/postBuild

100755100644
+9-30
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,38 @@
11
#!/usr/bin/env python3
2-
""" perform a development install of gluepyter
3-
2+
""" perform a development install of jupytercad
43
On Binder, this will run _after_ the environment has been fully created from
54
the environment.yml in this directory.
6-
75
This script should also run locally on Linux/MacOS/Windows:
8-
96
python3 binder/postBuild
107
"""
118
import subprocess
129
import sys
1310
from pathlib import Path
14-
11+
import shutil
1512

1613
ROOT = Path.cwd()
1714

15+
shutil.copy(ROOT / "binder" / "jupyter_config.json", ROOT)
1816

1917
def _(*args, **kwargs):
2018
"""Run a command, echoing the args
21-
2219
fails hard if something goes wrong
2320
"""
24-
print("\n\t", " ".join(args), "\n")
21+
print("\n\t", " ".join(args), "\n", flush=True)
2522
return_code = subprocess.call(args, **kwargs)
2623
if return_code != 0:
27-
print("\nERROR", return_code, " ".join(args))
24+
print("\nERROR", return_code, " ".join(args), flush=True)
2825
sys.exit(return_code)
2926

3027

28+
# remove incompatible binder baseline packages
29+
_("mamba", "uninstall", "jupyter-resource-usage")
30+
3131
# verify the environment is self-consistent before even starting
3232
_(sys.executable, "-m", "pip", "check")
3333

3434
# install the labextension
35-
_(sys.executable, "-m", "pip", "install", "-e", ".")
36-
_(sys.executable, "-m", "jupyter", "labextension", "develop", "--overwrite", ".")
37-
_(
38-
sys.executable,
39-
"-m",
40-
"jupyter",
41-
"serverextension",
42-
"enable",
43-
"gluepyter",
44-
)
45-
_(
46-
sys.executable,
47-
"-m",
48-
"jupyter",
49-
"server",
50-
"extension",
51-
"enable",
52-
"gluepyter",
53-
)
54-
55-
# verify the environment the extension didn't break anything
56-
_(sys.executable, "-m", "pip", "check")
35+
_(sys.executable, "-m", "pip", "install", ".")
5736

5837
# list the extensions
5938
_("jupyter", "server", "extension", "list")

binder/start

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo $@
6+
7+
exec jupyter-lab --collaborative "${@:4}"

0 commit comments

Comments
 (0)