Home

Awesome

jupyterlab-git

Binder Github Actions Status Version Version Downloads Version Downloads<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> All Contributors

<!-- ALL-CONTRIBUTORS-BADGE:END -->

A JupyterLab extension for version control using Git

ui_glow_up

To see the extension in action, open the example notebook included in the Binder demo.

Requirements

For older versions of JupyterLab, go to:

Usage

Install

To install perform the following steps, with pip:

pip install --upgrade jupyterlab jupyterlab-git

or with conda:

conda install -c conda-forge jupyterlab jupyterlab-git

Uninstall

To remove the extension, execute:

pip uninstall jupyterlab-git

or with conda:

conda remove jupyterlab-git

Settings

Authentication to remote repository hosts

If you are seeing errors similar to [E yyyy-mm-dd hh:mm:ss ServerApp] 500 POST /git/<clone|push|pull|status> on the console which is running the JupyterLab server, you probably need to set up a credentials store for your local Git repository.

This extension tries to handle credentials for HTTP(S) connections (if you don't have set up a credential manager). But not for other SSH connections.

For Windows users, it is recommended to install git for windows. It will automatically set up a credential manager. In order to connect to a remote host, it is recommended to use SSH.

HTTP(S) protocol

The extension can cache temporarily (by default for an hour) credentials. To use the caching, you will need to check the option Save my login temporarily in the dialog asking your credentials.

You can set a longer cache timeout; see Server Settings.

This is a new feature since v0.37.0

SSH protocol

Here are the steps to follow to set up SSH authentication (skip any that is already accomplished for your project):

  1. Create a SSH key
  2. Register the public part of it to your Git server:
  3. Optionally, if you have more than one key managed by your ssh agent: Create a config file for the ssh-agent
  4. Tell your local Git repository to connect to remote via ssh

You should now be able to pull and push committed changes to and from your remote repository using the respective buttons on the top of the extension's panel.

UI Settings

Once installed, extension behavior can be modified via the following settings which can be set in JupyterLab's advanced settings editor:

Server Settings

<details> <summary><b>How to set server settings?</b></summary>

In $HOME/.jupyter/jupyter_notebook_config.py (on Windows %USERPROFILE%/.jupyter/jupyter_notebook_config.py):

c.JupyterLabGit.actions = {"post_init": ["touch dummy_init.dat"]}
c.JupyterLabGit.credential_helper = 'cache --timeout=3600'

Or equivalently in $HOME/.jupyter/jupyter_notebook_config.json (on Windows %USERPROFILE%/.jupyter/jupyter_notebook_config.json):

{
  "JupyterLabGit": {
    "actions": {
      "post_init": ["touch dummy_init.dat"]
    },
    "credential_helper": "cache --timeout=3600"
  }
}
</details>

Troubleshoot

If you are seeing the frontend extension, but it is not working, check that the server extension is enabled:

jupyter server extension list

If the server extension is installed and enabled, but you are not seeing the frontend extension, check the frontend extension is installed:

jupyter labextension list

If they do not match or one is missing, please reinstall the package.

<details><summary>the Git panel does not recognize that you are in a Git repository.</summary>

Possible fixes:

</details> <details> <summary>the Git panel is not visible.</summary>

Possible fixes:

</details>

Contributing

If you would like to contribute to the project, please read our contributor documentation.

JupyterLab follows the official Jupyter Code of Conduct.

Development install

Note: You will need NodeJS to build the extension package.

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
git clone https://github.com/jupyterlab/jupyterlab-git.git
# Change directory to the jupyterlab-git directory
cd jupyterlab-git
# Install package in development mode
pip install -e ".[dev,test]"
pre-commit install
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable jupyterlab_git
# Rebuild extension Typescript source after making changes
jlpm run build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the jlpm run build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

jupyter lab build --minimize=False

Development uninstall

# Server extension must be manually disabled in develop mode
jupyter server extension disable jupyterlab_git
pip uninstall jupyterlab_git

In development mode, you will also need to remove the symlink created by jupyter labextension develop command. To find its location, you can run jupyter labextension list to figure out where the labextensions folder is located. Then you can remove the symlink named @jupyterlab/git within that folder.

Testing the extension

Server tests

This extension is using Pytest for Python code testing.

Install test dependencies (needed only once):

pip install -e ".[test]"
# Each time you install the Python package, you need to restore the front-end extension link
jupyter labextension develop . --overwrite

To execute them, run:

pytest -vv -r ap --cov jupyterlab_git

Frontend tests

This extension is using Jest for JavaScript code testing.

To execute them, execute:

jlpm
jlpm test

Integration tests

This extension uses Playwright for the integration tests (aka user level tests). More precisely, the JupyterLab helper Galata is used to handle testing the extension in JupyterLab.

More information are provided within the ui-tests README.

Packaging the extension

See RELEASE

Contributors ✨

The Jupyter Git extension is part of Project Jupyter and is developed by an open community of contributors. To see who has been active recently, please look at the "Contributors" tab. Below we list the people and entities who contributed in different ways to the project (emoji key):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://amazon.com/aws"><img src="https://avatars3.githubusercontent.com/u/2232217?v=4?s=100" width="100px;" alt="Amazon Web Services"/><br /><sub><b>Amazon Web Services</b></sub></a><br /><a href="#financial-aws" title="">🀝</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ashutoshbondre"><img src="https://avatars0.githubusercontent.com/u/13174154?v=4?s=100" width="100px;" alt="Ashutosh Bondre"/><br /><sub><b>Ashutosh Bondre</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=ashutoshbondre" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Aashutoshbondre" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/stdlib-js/stdlib"><img src="https://avatars0.githubusercontent.com/u/2643044?v=4?s=100" width="100px;" alt="Athan"/><br /><sub><b>Athan</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=kgryte" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Akgryte" title="Reviewed Pull Requests">πŸ‘€</a> <a href="#projectManagement-kgryte" title="Project Management">πŸ“†</a> <a href="#design-kgryte" title="Design">🎨</a></td> <td align="center" valign="top" width="14.28%"><a href="https://basokant.com"><img src="https://avatars.githubusercontent.com/u/70033855?v=4?s=100" width="100px;" alt="Ben Asokanthan"/><br /><sub><b>Ben Asokanthan</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=basokant" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/BoscoCHW"><img src="https://avatars.githubusercontent.com/u/45115214?v=4?s=100" width="100px;" alt="Bosco Chan"/><br /><sub><b>Bosco Chan</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=BoscoCHW" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ellisonbg"><img src="https://avatars3.githubusercontent.com/u/27600?v=4?s=100" width="100px;" alt="Brian E. Granger"/><br /><sub><b>Brian E. Granger</b></sub></a><br /><a href="#projectManagement-ellisonbg" title="Project Management">πŸ“†</a> <a href="#design-ellisonbg" title="Design">🎨</a> <a href="#ideas-ellisonbg" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="#fundingFinding-ellisonbg" title="Funding Finding">πŸ”</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/Damans227"><img src="https://avatars.githubusercontent.com/u/61474540?v=4?s=100" width="100px;" alt="Daman Arora"/><br /><sub><b>Daman Arora</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=Damans227" title="Code">πŸ’»</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://dquach.dev"><img src="https://avatars.githubusercontent.com/u/6735818?v=4?s=100" width="100px;" alt="Dat Quach"/><br /><sub><b>Dat Quach</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=quachtridat" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/fcollonval"><img src="https://avatars1.githubusercontent.com/u/8435071?v=4?s=100" width="100px;" alt="FrΓ©dΓ©ric Collonval"/><br /><sub><b>FrΓ©dΓ©ric Collonval</b></sub></a><br /><a href="#maintenance-fcollonval" title="Maintenance">🚧</a></td> <td align="center" valign="top" width="14.28%"><img src="https://avatars1.githubusercontent.com/u/27518229?v=4?s=100" width="100px;" alt="Hana Zarea"/><br /><sub><b>Hana Zarea</b></sub><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=hzarea" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Ahzarea" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="http://ianhi.github.io"><img src="https://avatars0.githubusercontent.com/u/10111092?v=4?s=100" width="100px;" alt="Ian Hunt-Isaak"/><br /><sub><b>Ian Hunt-Isaak</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=ianhi" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Aianhi" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/jaipreet-s"><img src="https://avatars1.githubusercontent.com/u/43826141?v=4?s=100" width="100px;" alt="Jaipreet Singh"/><br /><sub><b>Jaipreet Singh</b></sub></a><br /><a href="#projectManagement-jaipreet-s" title="Project Management">πŸ“†</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Ajaipreet-s" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=jaipreet-s" title="Code">πŸ’»</a> <a href="#design-jaipreet-s" title="Design">🎨</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/zzhangjii"><img src="https://avatars3.githubusercontent.com/u/11495372?v=4?s=100" width="100px;" alt="Ji Zhang"/><br /><sub><b>Ji Zhang</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=zzhangjii" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Azzhangjii" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/kentarolim10"><img src="https://avatars.githubusercontent.com/u/61769040?v=4?s=100" width="100px;" alt="Kentaro Lim"/><br /><sub><b>Kentaro Lim</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=kentarolim10" title="Code">πŸ’»</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="http://taletskiy.com"><img src="https://avatars0.githubusercontent.com/u/8834829?v=4?s=100" width="100px;" alt="Konstantin Taletskiy"/><br /><sub><b>Konstantin Taletskiy</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=ktaletsk" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Aktaletsk" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://kostyafarber.com"><img src="https://avatars.githubusercontent.com/u/73378227?v=4?s=100" width="100px;" alt="Kostya Farber"/><br /><sub><b>Kostya Farber</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=kostyafarber" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://www.lindaful.com"><img src="https://avatars.githubusercontent.com/u/68607795?v=4?s=100" width="100px;" alt="Linda Ngoc Nguyen"/><br /><sub><b>Linda Ngoc Nguyen</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=iflinda" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://fellowship.mlh.io/"><img src="https://avatars.githubusercontent.com/u/65834464?s=200&v=4?s=100" width="100px;" alt="Major League Hacking"/><br /><sub><b>Major League Hacking</b></sub></a><br /><a href="#financial-mlh" title="">🀝</a></td> <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/max-klein-b514419"><img src="https://avatars2.githubusercontent.com/u/2263641?v=4?s=100" width="100px;" alt="Max Klein"/><br /><sub><b>Max Klein</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=telamonian" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Atelamonian" title="Reviewed Pull Requests">πŸ‘€</a> <a href="#projectManagement-telamonian" title="Project Management">πŸ“†</a> <a href="#design-telamonian" title="Design">🎨</a> <a href="#infra-telamonian" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a></td> <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/michal-krassowski/"><img src="https://avatars.githubusercontent.com/u/5832902?v=4?s=100" width="100px;" alt="MichaΕ‚ Krassowski"/><br /><sub><b>MichaΕ‚ Krassowski</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=krassowski" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Akrassowski" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/jupyterlab/jupyterlab-git/issues?q=author%3Akrassowski" title="Bug reports">πŸ›</a></td> <td align="center" valign="top" width="14.28%"><a href="https://navn.me"><img src="https://avatars.githubusercontent.com/u/59669957?v=4?s=100" width="100px;" alt="Navinn Ravindaran"/><br /><sub><b>Navinn Ravindaran</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=navn-r" title="Code">πŸ’»</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/neelamgehlot"><img src="https://avatars2.githubusercontent.com/u/15882916?v=4?s=100" width="100px;" alt="Neelam Gehlot"/><br /><sub><b>Neelam Gehlot</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=neelamgehlot" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Aneelamgehlot" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="http://noahstapp.com/"><img src="https://avatars0.githubusercontent.com/u/30483654?v=4?s=100" width="100px;" alt="Noah Stapp"/><br /><sub><b>Noah Stapp</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=NoahStapp" title="Code">πŸ’»</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3ANoahStapp" title="Reviewed Pull Requests">πŸ‘€</a></td> <td align="center" valign="top" width="14.28%"><a href="https://www.saulshanabrook.com/"><img src="https://avatars1.githubusercontent.com/u/1186124?v=4?s=100" width="100px;" alt="Saul Shanabrook"/><br /><sub><b>Saul Shanabrook</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=saulshanabrook" title="Code">πŸ’»</a> <a href="#projectManagement-saulshanabrook" title="Project Management">πŸ“†</a> <a href="https://github.com/jupyterlab/jupyterlab-git/pulls?q=is%3Apr+reviewed-by%3Asaulshanabrook" title="Reviewed Pull Requests">πŸ‘€</a> <a href="#infra-saulshanabrook" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/shawnesquivel"><img src="https://avatars.githubusercontent.com/u/94336773?v=4?s=100" width="100px;" alt="Shawn Esquivel"/><br /><sub><b>Shawn Esquivel</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=shawnesquivel" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="http://sheezaaziz.com"><img src="https://avatars.githubusercontent.com/u/47278108?v=4?s=100" width="100px;" alt="Sheeza Aziz"/><br /><sub><b>Sheeza Aziz</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=sheezaaziz" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="http://sinakhalili.com"><img src="https://avatars.githubusercontent.com/u/20732540?v=4?s=100" width="100px;" alt="Sina Khalili"/><br /><sub><b>Sina Khalili</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=SinaKhalili" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://www.deshaw.com/"><img src="https://avatars0.githubusercontent.com/u/2298205?v=4?s=100" width="100px;" alt="The D. E. Shaw Group"/><br /><sub><b>The D. E. Shaw Group</b></sub></a><br /><a href="#financial-deshaw" title="">🀝</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ZeshanFayyaz"><img src="https://avatars.githubusercontent.com/u/43391249?v=4?s=100" width="100px;" alt="Zeshan Fayyaz"/><br /><sub><b>Zeshan Fayyaz</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=ZeshanFayyaz" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://dub.sh/lzongxun"><img src="https://avatars.githubusercontent.com/u/63457492?v=4?s=100" width="100px;" alt="Zong Xun"/><br /><sub><b>Zong Xun</b></sub></a><br /><a href="https://github.com/jupyterlab/jupyterlab-git/commits?author=Zxun2" title="Code">πŸ’»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/jupytercalpoly"><img src="https://avatars0.githubusercontent.com/u/19445175?v=4?s=100" width="100px;" alt="jupytercalpoly"/><br /><sub><b>jupytercalpoly</b></sub></a><br /><a href="#financial-jupytercalpoly" title="">🀝</a></td> </tr> </tbody> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the all-contributors specification. Contributions of any kind are welcomed!

To add yourself, or someone else, to this list you can either use the bot (@all-contributors please add <username> for <contributions>) or the CLI (jlpm all-contributors add <username> <contributions>).

If you manually edit the .all-contributorsrc config file, run yarn run contributors:generate.