jupyterhub / binderhub

Run your code in the cloud, with technology so advanced, it feels like magic!
https://binderhub.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.56k stars 390 forks source link

Create PR from running binder #623

Open betatim opened 6 years ago

betatim commented 6 years ago

A common feature request is being able to push results back to the source repository. This is tricky on a public instance as it would require you to type in your GitHub/GitLab credentials.

An alternative would be to add a service to JupyterHub that allows users to say "please create a PR with the state of the repo in my container". This PR would be created by "mybinderbot" and users could then accept the PR.

What is the general feeling on the feasibility of such a service? Would we be able to enable this on a public instance like https://mybinder.org?

choldgraf commented 6 years ago

ah that's an interesting idea - so basically accomplish the same thing but without any sensitive info getting passed. Seems like it could "just" be a notebook extension, no?

betatim commented 6 years ago

If it was just a nb extension then the credentials for the mybinderbot account would be accessible to the user. So we need a nb extension that figures out what to push/packages state of the repo and a service to send that package to that then makes the PR.

choldgraf commented 6 years ago

ah that's an interesting idea - so basically accomplish the same thing but without any sensitive info getting passed. I wonder if this could just be a server-side extension?

betatim commented 6 years ago

I don't think so. You can't make it a notebook server extension as the mybinderbot token would still be available from within the container that the user is running in. (I assumed you mean notebook server extension.)

BoPeng commented 5 years ago

My google search for a way for online modification of jupyter notebooks lands me here.

Basically, the documentation of my project are converted from a set of jupyter notebook. Right now, the normal way to modify or contribute to it is to clone the repository, install all relevant tools, modify the notebooks using Jupyter or Jupyter Lab, then submit a PR. We already have docker images for binder and tmpnd so it is relatively easy to allow users to edit the notebooks. However, none of the methods allow the changes to be submitted. It would be very nice if there is some way to allow users to create PRs directly.

kkmann commented 5 years ago

:+1: usecase: online collaboration between stat + med; med can edit markdown, maybe change parameters; stat codes the analyses. For this to work, both must be able to save the results back to the repo, i.e. PR. Would be awesome to have. Most interesting on a private secure binderhub config but the solution with having a mybinder bot create a PR seems fine for public instances.

BoPeng commented 5 years ago

After I posted in this thread, we decided to use our live JupyterHub server to allow visitors to propose changes to our documentation. The process is a bit complicated:

  1. On the documentation side, we added an edit button to our template. This results in an edit button on all our tutorials (see the edit button at the top right corner of this page). Clicking this button will open the corresponding page on our live server.
  2. On the server side, the JupyterHub server spawns a docker image that contains a recent clone of the source of notebooks.
  3. A create-pr script is also included in the docker image, and allows users to create a PR after they modify the notebook. This script basically runs a bunch of git commands and then creates a PR using github CLI .

The whole process works pretty well in that anyone can visit our documentation, click the edit button to edit it, and send us a PR using command create-pr.

betatim commented 5 years ago

Most interesting on a private secure binderhub config but the solution with having a mybinder bot create a PR seems fine for public instances.

For a private instance the worries of users submitting credentials to the running Binder is lower/doesn't exist. This means you can use the normal git commands from the terminal or other notebook server extensions that implement interaction with GitHub (not sure if they exist).

sgibson91 commented 5 years ago

I love this idea! It's been a hope and dream of mine as well, particularly for private/institutional Hubs.

psychemedia commented 4 years ago

The fastai/fastpages Jekyll/github pages publishing route is quite interesting in that when you clone the original repo, it creates a PR on your new repo.

This pattern, of tasks creating PRs on a repo could be quite an interesting on. Being able to create PRs onto the repo from which a binderised repo instance was generated via a Binderhub agent is a really interesting one. Though to protect the repo owner, it might also be useful if the could somehow whether declare whether they were open to such PRs or not.