Skip to content

Allow to launch from binder with nbgitpuller #282

@fmaussion

Description

@fmaussion

This is a follow-up to a post I opened on meta

For reasons discussed at length here, I'd like my JupyterBook notebooks to be launched via gitpuller in another binder-ready repository.

This is quite niche I suppose, but if you'd agree to have this as a feature I'd be happy to submit a PR for this functionality. The exact API is a bit fuzzy in my mind though.

I'd start by adding an option here:

if binderhub_url:
url = (
f"{binderhub_url}/v2/gh/{org}/{repo}/{branch}?"
f"urlpath={ui_pre}/{path_rel_repo}"
)
context["binder_url"] = url
if jupyterhub_url:
url = (
f"{jupyterhub_url}/hub/user-redirect/git-pull?"
f"repo={repo_url}&urlpath={ui_pre}/{repo}/{path_rel_repo}&branch={branch}"
)
context["jupyterhub_url"] = url

by adding something that could look like:

    if binder_repo and binderhub_url:
        url = (
            f"{binderhub_url}/v2/gh/{binder_repo}/master?urlpath=git-pull?"
            f"repo={repo_url}%26amp%3Bbranch=master%26amp%3Burlpath={ui_pre}/{repo}/{path_rel_repo}%3Fautodecode"
        )
        context["binder_url"] = url

It starts to become quite dirty at the moment where you'd like fine tuned control on the branch to use on the binder repo, etc.

Just let me know what you think. I have a patched version that does what I want (book) and I guess that I could also get what I want by writing an extension to sphinx-book-theme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions