Skip to content

Commit 150657c

Browse files
authored
Update binder (#189)
* Update binder * Update postBuild * Fix pip check error * Remove useless enable command
1 parent 923f588 commit 150657c

File tree

2 files changed

+62
-14
lines changed

2 files changed

+62
-14
lines changed

binder/environment.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
name: jupyterlab_code_formatter
22
channels:
3-
- conda-forge
4-
- r
3+
- conda-forge
4+
- r
55
dependencies:
6-
- autopep8
7-
- black
8-
- isort
9-
- jupyterlab=0.35
10-
- yapf
11-
- rpy2
12-
- r-formatr
13-
- r-styler
14-
- pip:
15-
- jupyterlab_code_formatter
6+
# runtime dependencies
7+
- python >=3.8,<3.9.0a0
8+
- jupyterlab >=3.0.0,<4.0.0
9+
# labextension build dependencies
10+
- nodejs >=14,<15
11+
- pip
12+
- wheel
13+
# Additional dependencies
14+
- autopep8
15+
- black
16+
- isort
17+
- yapf
18+
- rpy2
19+
- r-formatr
20+
- r-styler
21+
# pip check fixes
22+
- pytest
23+
- parso >=0.8.0,<0.9.0
24+
- jupyter_telemetry >=0.1.0

binder/postBuild

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1-
jupyter labextension install @ryantam626/jupyterlab_code_formatter
1+
#!/usr/bin/env python3
2+
""" perform a development install of jupyter-archive
3+
On Binder, this will run _after_ the environment has been fully created from
4+
the environment.yml in this directory.
5+
This script should also run locally on Linux/MacOS/Windows:
6+
python3 binder/postBuild
7+
"""
8+
import subprocess
9+
import sys
10+
from pathlib import Path
211

3-
jupyter serverextension enable --py jupyterlab_code_formatter
12+
13+
ROOT = Path.cwd()
14+
15+
def _(*args, **kwargs):
16+
""" Run a command, echoing the args
17+
fails hard if something goes wrong
18+
"""
19+
print("\n\t", " ".join(args), "\n")
20+
return_code = subprocess.call(args, **kwargs)
21+
if return_code != 0:
22+
print("\nERROR", return_code, " ".join(args))
23+
sys.exit(return_code)
24+
25+
# verify the environment is self-consistent before even starting
26+
_(sys.executable, "-m", "pip", "check")
27+
28+
# install the labextension
29+
_(sys.executable, "-m", "pip", "install", "-e", ".")
30+
31+
# verify the environment the extension didn't break anything
32+
_(sys.executable, "-m", "pip", "check")
33+
34+
# list the extensions
35+
_("jupyter", "server", "extension", "list")
36+
37+
# initially list installed extensions to determine if there are any surprises
38+
_("jupyter", "labextension", "list")
39+
40+
41+
print("JupyterLab with jupyter-archive is ready to run with:\n")
42+
print("\tjupyter lab\n")

0 commit comments

Comments
 (0)