|
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 |
2 | 11 |
|
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