diff --git a/binder/environment.yml b/binder/environment.yml index 64fb5b3..9b669a9 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -1,15 +1,24 @@ name: jupyterlab_code_formatter channels: -- conda-forge -- r + - conda-forge + - r dependencies: -- autopep8 -- black -- isort -- jupyterlab=0.35 -- yapf -- rpy2 -- r-formatr -- r-styler -- pip: - - jupyterlab_code_formatter \ No newline at end of file + # runtime dependencies + - python >=3.8,<3.9.0a0 + - jupyterlab >=3.0.0,<4.0.0 + # labextension build dependencies + - nodejs >=14,<15 + - pip + - wheel + # Additional dependencies + - autopep8 + - black + - isort + - yapf + - rpy2 + - r-formatr + - r-styler + # pip check fixes + - pytest + - parso >=0.8.0,<0.9.0 + - jupyter_telemetry >=0.1.0 diff --git a/binder/postBuild b/binder/postBuild index d6049f6..c92a357 100644 --- a/binder/postBuild +++ b/binder/postBuild @@ -1,3 +1,42 @@ -jupyter labextension install @ryantam626/jupyterlab_code_formatter +#!/usr/bin/env python3 +""" perform a development install of jupyter-archive + On Binder, this will run _after_ the environment has been fully created from + the environment.yml in this directory. + This script should also run locally on Linux/MacOS/Windows: + python3 binder/postBuild +""" +import subprocess +import sys +from pathlib import Path -jupyter serverextension enable --py jupyterlab_code_formatter + +ROOT = Path.cwd() + +def _(*args, **kwargs): + """ Run a command, echoing the args + fails hard if something goes wrong + """ + print("\n\t", " ".join(args), "\n") + return_code = subprocess.call(args, **kwargs) + if return_code != 0: + print("\nERROR", return_code, " ".join(args)) + sys.exit(return_code) + +# verify the environment is self-consistent before even starting +_(sys.executable, "-m", "pip", "check") + +# install the labextension +_(sys.executable, "-m", "pip", "install", "-e", ".") + +# verify the environment the extension didn't break anything +_(sys.executable, "-m", "pip", "check") + +# list the extensions +_("jupyter", "server", "extension", "list") + +# initially list installed extensions to determine if there are any surprises +_("jupyter", "labextension", "list") + + +print("JupyterLab with jupyter-archive is ready to run with:\n") +print("\tjupyter lab\n")