Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JupyterLab extension to create GitHub commits & pull requests

License

NotificationsYou must be signed in to change notification settings

ReviewNB/jupyterlab-gitplus

Repository files navigation

A JupyterLab plugin for version control of Jupyter notebooks. It can,

  • Push GitHub commits from JupyterLab
  • Create GitHub pull request from JupyterLab

Demo

Create GitHub Pull Request from JupyterLab

Create GitHub Pull Request from JupyterLab

Push GitHub Commits from JupyterLab

Push GitHub Commits from JupyterLab

Requirements

  • JupyterLab 2.x or 3.x
  • Git (runninggit on cmdline or terminal should work)

Install

1. Install Required Packages

pip install --upgrade jupyterlab_gitplusjupyter labextension install @reviewnb/jupyterlab_gitplusjupyter serverextensionenable --py jupyterlab_gitplus

2. Setup GitHub token

Tokens are required to make API calls to GitHub to push commits and create pull requests.

  • Head overdeveloper settings on GitHub. Click "Generate New Token".
  • Selectrepo scope. Click "Generate Token". Copy the generated token.
  • If~/.jupyter/jupyter_notebook_config.pydoes not exist then create one by runningjupyter notebook --generate-config
  • Open you Jupyter config file~/.jupyter/jupyter_notebook_config.py & paste the token as shown below
c.GitPlus.github_token ='<your-github-access-token>'

After installation, start JupyterLab normally & you should see "Git-Plus" as a new menu item at the top.

3. [OPTIONAL] Only required for self-hosted ReviewNB customers

If your organization has a self-hosted ReviewNB instance running at e.g.https://reviewnb.yourdomain.com. You can configureGitPlus to link users to PRs/commits at this URL instead of the default one as follows:

c.GitPlus.self_hosted_reviewnb_endpoint="https://reviewnb.yourdomain.com/"

FAQ

Where is pull request (PR) opened in case of forked repositories?

If your repository is forked from another repository (parent) then PR will be created on parent repository.

Which is thebase branch used in a pull request?

base branch in a PR is a branch against which your changes are compared and ultimately merged. We use repository's default branch (usually calledmaster) asbase branch of PR. We use parent repository's default branch asbase in case of forked repo.

Which is thehead branch used in a pull request?

head branch in a PR is a branch which contains the latest changes you've made. We create a new branch (e.g.gitplus-xyz123) ashead branch. It only contains changes from the files you wish to include in the PR.

How can I edit a pull request opened with GitPlus?

You can head over to GitHub and edit the PR metadata to your liking. For pushing additional file changes to the same PR,

  1. Copy the branch name from GitHub UI (e.g.gitplus-xyz123)
  2. Checkout that branch locally
  3. Make the file changes you want
  4. Use push commit functionality from GitPlus to push new changes

Is GitPlus tied to ReviewNB in any way?

No. GitPlus is it's own open source project. The only connection with ReviewNB is that at the end of PR/Commit creation, GitPlus shows ReviewNB URL along with GitHub URL. You can safely ignore these URLs if you don't want to use ReviewNB.

It's is useful to seevisual notebook diffs on ReviewNB instead of hard to readJSON diffs on GitHub.ReviewNB also facilitates discussion on notebooks cells.

What if I don't have a ReviewNB account?

No problem, everything in GitPlus will still work fine. Only the ReviewNB URLs won't work for you.

Can we use GitPlus with Gitlab/BitBucket or any other platforms?

No, currently we only support repositories on GitHub.

Motivation

Our aim is to make notebooks a first class entity in Data science & ML teams. We can achieve this by making notebooks play well with existing tools & processes instead of building expensive proprietary platforms. Other projects in this direction are,

  • ReviewNB - Code review tool for Jupyter notebooks
  • treon - Easy to use test framework for Jupyter notebooks

Roadmap

In future GitPlus will be able to,

  • Pull changes from GitHub
  • Switch/create branches locally
  • Resolve notebook merge conflicts (without messing with underlying JSON)

Development

Install

Thejlpm command is JupyterLab's pinned version ofyarn that is installed with JupyterLab. You may useyarn ornpm in lieu ofjlpm below.

# Clone the repo to your local environment & install dependencies# via https://jupyterlab.readthedocs.io/en/stable/extension/extension_tutorial.html#build-and-install-the-extension-for-developmentpip install -ve.# Link your development version of the extension with JupyterLabjupyter labextension link.# Run jupyterlab in watch mode in one terminal tabjupyter lab --watch# Watch the GitPlus source directory in another terminal tabjlpm watch# If you make any changes to server side extension (.py files) then reinstall it from sourcepip install.

Contributing

If you see any problem, open an issue or send a pull request. You can write tosupport@reviewnb.com for any questions.

About

JupyterLab extension to create GitHub commits & pull requests

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp