Skip to content
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

JupyterLab Pull Requests Extension #8

Closed
jaipreet-s opened this issue Jul 23, 2019 · 13 comments
Closed

JupyterLab Pull Requests Extension #8

jaipreet-s opened this issue Jul 23, 2019 · 13 comments

Comments

@jaipreet-s
Copy link
Member

Background

Pull requests are an important part of the dev workflow. Users currently would use JupyterLab for development and then switch to the respective Git hosting service website (e.g. GitHub) for PRs. GitHub (among others) also does not offer a visual diff experience for ipynb files which have to be reviewed in their raw JSON format.

Current Status

@timnlupo has been working to develop an extension for performing pull requests from within JupyterLab. The functionality that is currently built in includes

  • View pull requests assigned to the user and created by the current user
  • View the files that changed in each pull request
  • View the diff of a file changed in a PR
    • This includes the cell-level diff if the file is a Notebook file
  • Add comments to a file in the PR
    • For Notebook files, this provides cell-level comments and line-level diffs for plaintext files.

All screenshots can be found here and a GIF at the bottom.

This is backed by a server extension which provides authenticated access to the GitHub APIs and uses the APIs for comment storage and retrieval.

Relation with other projects

  • Comments: It is expected that this adopts the commenting system and data model being built in here. There’s some flexibility that would be required around identity providers and comment storage locations but we should go for a unified commenting experience.
  • Git/NBDime: This builds upon the work that that has been done in NBDime for Notebook diffs as well as in the Git extension for visual diffs of notebook files to add a layer of commenting on top of diffs.
    • Pull Requests could be a natural extension to the Git experience. For example, a useful feature would be to create a PR from within JupyterLab after a push from the Git extension
  • GitHub: The GitHub extension allows growing GitHub repos, and a possible integration would be to be able to view open PRs on the current repo.

Feature plans

There’s a few features that would add a ton of value.

  • Check-out a pull request locally - Allowing a user to execute the Notebooks and other files to give a thorough review
  • Supporting multiple Git hosting services (BitBucket, GitLab etc). Since folks often do PRs across multiple services, the ability to switch between them within the same extension would be handy
    • In the current implementation, the server extension has a "manager" interface for the Git hosting service which can be implemented to support another Git hosting service with the same front-end code and handlers.

Next Steps

We are looking for feedback around the functionality built so far and that planned forward. Our proposal would be to have a jupyterlab/pull-requests repo for the extension where this can be iterated upon and contributed to, for building further functionality and integrations with the commenting/nbdime/git.

JupyterLabPullRequestDemo

@blink1073
Copy link
Contributor

Thanks for his work @jaipreet-s and @timnlupo. I agree with jupyterlab/pull-requests and would like to have this installed in @ian-r-rose's bot so that we could use this on any PR.

@blink1073
Copy link
Contributor

Bot example

@ian-r-rose
Copy link
Member

@blink1073 How would you envision linking to the bot working? @jhamman has also put a bit of work recently into making it more configurable so it would work for other repos.

@blink1073
Copy link
Contributor

blink1073 commented Jul 24, 2019

I think in the build script for the docker image we'd install this extension, which could be replicated elsewhere.

@jaipreet-s
Copy link
Member Author

jaipreet-s commented Jul 24, 2019

@blink1073 : Thanks! We were also thinking if we could point JupyterLab to a URL (like /lab/prs/github/jupyterlab/123) to open up Lab with the given PR view and make the GitHub <-> JupyterLab round-tripping smoother.

Its my first time going through this process and was looking for guidance on next steps here. Do we wait for more feedback before requesting the jupyterlab/pull-requests repo?

@blink1073
Copy link
Contributor

Done - https://github.com/jupyterlab/pull-requests. Please let me know if you do not have admin rights there.

@jaipreet-s
Copy link
Member Author

Awesome, @blink1073! I'm out the rest of this week but we'll move over @timnlupo's code here and draft out a roadmap with next steps.

@blink1073
Copy link
Contributor

blink1073 commented Jul 25, 2019

👍

@jaipreet-s
Copy link
Member Author

@blink1073 : I tried to push an initial commit to the repo so @timnlupo can fork it (Apparently we can't fork an empty repo) but I got a permissions error

remote: Permission to jupyterlab/pull-requests.git denied to jaipreet-s.
fatal: unable to access 'https://github.com/jupyterlab/pull-requests/': The requested URL returned error: 403

@blink1073
Copy link
Contributor

@jaipreet-s, it looks like the default when creating a new repo is that no one has write access outside of admins. I added the "committers" team to that repo. Cheers!

@jaipreet-s
Copy link
Member Author

jaipreet-s commented Jul 30, 2019

@blink1073 , I've been trying to push an initial README.md to master but to no avail. So far I've tried

  • SSH
git push
ERROR: Permission to jupyterlab/pull-requests.git denied to jaipreet-s.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • HTTPS
Username for 'https://github.com/jupyterlab/pull-requests': jaipreet-s
Password for 'https://[email protected]/jupyterlab/pull-requests': 
remote: Permission to jupyterlab/pull-requests.git denied to jaipreet-s.
fatal: unable to access 'https://github.com/jupyterlab/pull-requests/': The requested URL returned error: 403

I'm not sure if some permission is still missing or GitHub is messing up because its an empty repo. Both of these credentials (SSH Key and PAT for HTTPS ) work for directly pushing to the jupyterlab-git repo where I do have permissions)

@blink1073
Copy link
Contributor

@jaipreet-s, my mistake, you had admin rights only on the jupyterlab-git repo, I've added you to the committers group.

@jaipreet-s
Copy link
Member Author

@blink1073 : Works now! jupyterlab/pull-requests@563bf5d.

Good to close this now and move further activity to the repo. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants