binderize.binderize()

Prepare a GitHub repository to be launched via Binder.

Usage

Source

binderize.binderize(
    project=Path("."),
    detect_r=True,
    detect_python=True,
    branch="main",
    urlpath="rstudio",
    add_readme_badge=True,
    overwrite=True,
    verbose=False,
    optimize_pak=True
)

Writes a .binder/Dockerfile and inserts a Binder launch badge into the project’s README.md (or copies the badge snippet to the clipboard if the README has no badge section to insert into).

Parameters

project: Path or str = Path(".")

Path to the local Git repository to binderize. Must be a GitHub repository.

detect_r: bool = True

Whether to detect R dependencies and prepare the Docker image accordingly. One of (or both) detect_r or detect_python must be set to True.

detect_python: bool = True

Whether to detect Python dependencies and prepare the Docker image accordingly. One of (or both) detect_r or detect_python must be set to True.

branch: str = "main"

Branch to point the Binder launch link at.

urlpath: str = "rstudio"

URL path Binder should open to on launch (e.g. “rstudio”, “lab”).

add_readme_badge: bool = True

Whether to attempt to insert the Binder badge into the project’s README.md. If False, the badge snippet is copied to the clipboard and printed instead.

overwrite: bool = True

Whether to overwrite an existing .binder/Dockerfile.

verbose: bool = False

Whether to print the generated Binder Dockerfile contents.

optimize_pak: bool = True
Optimize R package installations in the Docker image. This should generally work. However, in some rare cases it can cause errors to occur. When encountering R package installation errors, setting this to False is typically a good, first debugging step.

Returns

None

Raises

ValueError
If the repository is not a GitHub repository.