Skip to content

Update binder #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions binder/environment.yml
Original file line number Diff line number Diff line change
@@ -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
# 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
43 changes: 41 additions & 2 deletions binder/postBuild
Original file line number Diff line number Diff line change
@@ -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")