• Stars
    star
    1,453
  • Rank 32,372 (Top 0.7 %)
  • Language
    TypeScript
  • License
    BSD 3-Clause "New...
  • Created over 7 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Git extension for JupyterLab

jupyterlab-git

Binder Github Actions Status Version Version Downloads Version Downloads All Contributors

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

  • JupyterLab >= 4.0 ([older version] available for 2.x and 3.x)
  • Git (version >=2.x)

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:

  • blockWhileCommandExecutes: suspend JupyterLab user interaction until Git commands (e.g., commit, pull, reset, revert) finish executing. Setting this to true helps mitigate potential race conditions leading to data loss, conflicts, and a broken Git history. Unless running a slow network, UI suspension should not interfere with standard workflows. Setting this to false allows for actions to trigger multiple concurrent Git actions.
  • cancelPullMergeConflict: cancel pulling changes from a remote repository if there exists a merge conflict. If set to true, when fetching and integrating changes from a remote repository, a conflicting merge is canceled and the working tree left untouched.
  • commitAndPush: Whether to trigger or not a push for each commit; default is false.
  • disableBranchWithChanges: disable all branch operations, such as creating a new branch or switching to a different branch, when there are changed/staged files. When set to true, this setting guards against overwriting and/or losing uncommitted changes.
  • displayStatus: display Git extension status updates in the JupyterLab status bar. If true, the extension displays status updates in the JupyterLab status bar, such as when pulling and pushing changes, switching branches, and polling for changes. Depending on the level of extension activity, some users may find the status updates distracting. In which case, setting this to false should reduce visual noise.
  • doubleClickDiff: double click a file in the Git extension panel to open a diff of the file instead of opening the file for editing.
  • historyCount: number of commits shown in the history log, beginning with the most recent. Displaying a larger number of commits can lead to performance degradation, so use caution when modifying this setting.
  • promptUserIdentity: Whether to prompt for user name and email on every commit.
  • refreshIfHidden: whether to refresh even if the Git tab is hidden; default to false (i.e. refresh is turned off if the Git tab is hidden).
  • refreshInterval: number of milliseconds between polling the file system for changes. In order to ensure that the UI correctly displays the current repository status, the extension must poll the file system for changes. Longer polling times increase the likelihood that the UI does not reflect the current status; however, longer polling times also incur less performance overhead.
  • simpleStaging: enable a simplified concept of staging. When this setting is true, all files with changes are automatically staged. When we develop in JupyterLab, we often only care about what files have changed (in the broadest sense) and don't need to distinguish between "tracked" and "untracked" files. Accordingly, this setting allows us to simplify the visual presentation of changes, which is especially useful for those less acquainted with Git.

Server Settings

  • JupyterLabGit.actions.post_init: Set post git init actions. It is possible to provide a list of commands to be executed in a folder after it is initialized as Git repository.
  • JupyterLabGit.credential_helper: Git credential helper to set to cache the credentials. The default value is cache --timeout=3600 to cache the credentials for an hour. If you want to cache them for 10 hours, set cache --timeout=36000.
  • JupyterLabGit.excluded_paths: Set path patterns to exclude from this extension. You can use wildcard and interrogation mark for respectively everything or any single character in the pattern.
  • JupyterLabGit.git_command_timeout_s: Set the timeout for git operations. Defaults to 20 seconds.
How to set server settings?

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"
  }
}

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.

the Git panel does not recognize that you are in a Git repository.

Possible fixes:

  • Be sure to be in a Git repository in the filebrowser tab

  • Check the server log. If you see a warning with a 404 code similar to: [W 00:27:41.800 LabApp] 404 GET /git/settings?version=0.20.0

    Explicitly enable the server extension by running:

    jupyter server extension enable --py jupyterlab_git
  • If you are using JupyterHub or some other technologies requiring an initialization script which includes the jupyterlab-git extension, be sure to install both the frontend and the server extension before launching JupyterLab.

the Git panel is not visible.

Possible fixes:

  • Check that the JupyterLab extension is installed:

    ```bash
    jupyter labextension list
    ```
    
    If you don't see `@jupyterlab/git v... enabled OK` in the list, explicitly install the jupyter labextension by running:
    
    ```bash
    jupyter labextension install @jupyterlab/git
    ```
    
    If you see `@jupyterlab/git` under `Uninstalled core extensions: `, your installation may have been corrupted. You can run `jupyter lab clean --all` and
    reinstall all your extensions.
    

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):

Amazon Web Services
Amazon Web Services

🀝
Ashutosh Bondre
Ashutosh Bondre

πŸ’» πŸ‘€
Athan
Athan

πŸ’» πŸ‘€ πŸ“† 🎨
Ben Asokanthan
Ben Asokanthan

πŸ’»
Bosco Chan
Bosco Chan

πŸ’»
Brian E. Granger
Brian E. Granger

πŸ“† 🎨 πŸ€” πŸ”
Daman Arora
Daman Arora

πŸ’»
Dat Quach
Dat Quach

πŸ’»
FrΓ©dΓ©ric Collonval
FrΓ©dΓ©ric Collonval

🚧
Hana Zarea
Hana Zarea
πŸ’» πŸ‘€
Ian Hunt-Isaak
Ian Hunt-Isaak

πŸ’» πŸ‘€
Jaipreet Singh
Jaipreet Singh

πŸ“† πŸ‘€ πŸ’» 🎨
Ji Zhang
Ji Zhang

πŸ’» πŸ‘€
Kentaro Lim
Kentaro Lim

πŸ’»
Konstantin Taletskiy
Konstantin Taletskiy

πŸ’» πŸ‘€
Kostya Farber
Kostya Farber

πŸ’»
Linda Ngoc Nguyen
Linda Ngoc Nguyen

πŸ’»
Major League Hacking
Major League Hacking

🀝
Max Klein
Max Klein

πŸ’» πŸ‘€ πŸ“† 🎨 πŸš‡
MichaΕ‚ Krassowski
MichaΕ‚ Krassowski

πŸ’» πŸ‘€ πŸ›
Navinn Ravindaran
Navinn Ravindaran

πŸ’»
Neelam Gehlot
Neelam Gehlot

πŸ’» πŸ‘€
Noah Stapp
Noah Stapp

πŸ’» πŸ‘€
Saul Shanabrook
Saul Shanabrook

πŸ’» πŸ“† πŸ‘€ πŸš‡
Shawn Esquivel
Shawn Esquivel

πŸ’»
Sheeza Aziz
Sheeza Aziz

πŸ’»
Sina Khalili
Sina Khalili

πŸ’»
The D. E. Shaw Group
The D. E. Shaw Group

🀝
Zeshan Fayyaz
Zeshan Fayyaz

πŸ’»
Zong Xun
Zong Xun

πŸ’»
jupytercalpoly
jupytercalpoly

🀝

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.

More Repositories

1

jupyterlab

JupyterLab computational environment.
TypeScript
14,050
star
2

jupyterlab-desktop

JupyterLab desktop application, based on Electron.
TypeScript
3,616
star
3

jupyter-ai

A generative AI extension for JupyterLab
Python
3,132
star
4

jupyterlab-toc

Table of Contents extension for JupyterLab
TypeScript
726
star
5

jupyterlab-latex

JupyterLab extension for live editing of LaTeX documents
TypeScript
626
star
6

lumino

Lumino is a library for building interactive web applications
TypeScript
612
star
7

debugger

A visual debugger for Jupyter notebooks, consoles, and source files
TypeScript
562
star
8

jupyter-renderers

Renderers and renderer extensions for JupyterLab
HTML
488
star
9

extension-examples

JupyterLab Extensions by Examples
TypeScript
443
star
10

jupyterlab-github

GitHub integration for JupyterLab
TypeScript
412
star
11

jupyterlab-google-drive

Cloud storage for JupyterLab using Google Drive
TypeScript
400
star
12

retrolab

JupyterLab distribution with a retro look and feel πŸŒ…
Jupyter Notebook
282
star
13

jupyterlab-monaco

A JupyterLab extension providing the Monaco editor
TypeScript
237
star
14

jupyterlab-demo

Demonstrations of JupyterLab
Jupyter Notebook
184
star
15

extension-cookiecutter-ts

A cookiecutter recipe for JupyterLab extensions in Typescript
CSS
179
star
16

jupyterlab-data-explorer

First class datasets in JupyterLab
TypeScript
178
star
17

jupyter-collaboration

A Jupyter Server Extension Providing Support for Y Documents
Jupyter Notebook
163
star
18

jupyterlab_server

A set of server components for JupyterLab and JupyterLab like applications
Python
139
star
19

jupyterlab-hdf5

Open and explore HDF5 files in JupyterLab. Can handle very large (TB) sized files, and datasets of any dimensionality
Jupyter Notebook
115
star
20

jupyterlab-celltags

A JupyterLab extension for notebook cell tags
TypeScript
113
star
21

jupyterlab-commenting

Commenting and annotation for JupyterLab
Jupyter Notebook
101
star
22

language-packs

Language packs for JupyterLab ecosystem
Python
78
star
23

scipy2018-jupyterlab-tutorial

Tutorial material and instruction for scipy 2018 jupyterlab tutorial
Jupyter Notebook
73
star
24

frontends-team-compass

A repository for team interaction, syncing, and handling meeting notes across the JupyterLab ecosystem.
58
star
25

extension-cookiecutter-js

A cookiecutter recipe for building JupyterLab extensions.
Python
55
star
26

jupyterlab-shortcutui

A JupyterLab extension for managing keyboard shortcuts
TypeScript
54
star
27

scipy2019-jupyterlab-tutorial

Scipy 2019 JupyterLab tutorial
Jupyter Notebook
51
star
28

extension-template

A `copier` template for JupyterLab extensions
Jinja
51
star
29

jupyterlab-statusbar

A status bar for JupyterLab
TypeScript
49
star
30

theme-cookiecutter

A cookiecutter template to help you make new JupyterLab theme extensions
CSS
49
star
31

jupyterlab-plugin-playground

A dynamic extension loader for JupyterLab
TypeScript
47
star
32

jupyterlab_pygments

Pygments theme making use of JupyterLab CSS variables
Python
39
star
33

hatch-jupyter-builder

A hatch plugin to help build Jupyter packages
Python
38
star
34

pull-requests

A JupyterLab extension for reviewing GitHub pull requests
Python
37
star
35

jupyterlab_xkcd

Random xkcd comic in a JupyterLab panel
TypeScript
31
star
36

galata

JupyterLab UI Testing Framework
JavaScript
30
star
37

jupyterlab-metadata-service

Linked data exploration in JupyterLab.
TypeScript
29
star
38

jupyterlab-telemetry

A JupyterLab extension for logging and telemetry of usage data
TypeScript
29
star
39

jupyterlab_apod

JupyterLab extension tutorial answer key. Please see the tutorial at https://jupyterlab.readthedocs.io/en/stable/extension/extension_tutorial.html
TypeScript
23
star
40

jupytercon-jupyterlab-tutorial

JupyterCon 2018 JupyterLab tutorial
Jupyter Notebook
22
star
41

mimerender-cookiecutter-ts

Cookie cutter for JupyterLab mimerenderer extensions using TypeScript
Python
19
star
42

pytest-check-links

pytest plugin that checks URLs
Python
17
star
43

jupyterlab-mp4

Example mimerenderer extension for showing mp4 videos.
TypeScript
17
star
44

mimerender-cookiecutter

A cookiecutter for rendering MIME type based output
Python
15
star
45

jupyter-chat

An extension to add a chat panel to JupyterLab
TypeScript
14
star
46

ui-profiler

Extension for profiling performance of JupyterLab UI for JupyterLab core developers, extension developers, and advanced users.
TypeScript
13
star
47

benchmarks

Benchmarking tools for JupyterLab
Jupyter Notebook
12
star
48

maintainer-tools

Workflows and Actions meant to be used by other repositories to make repo maintenance easier
Python
11
star
49

runall-extension

Add a "Run All Cells" toolbar button, context menu item, and keyboard shortcut.
TypeScript
8
star
50

jupyterlab-media

Repository storing movies and other media for JupyterLab tutorials and documentation
8
star
51

vscode-config-template

A copier template for creating the IDE config needed to debug the Python and Typescript code in any Jupyter project
Dockerfile
8
star
52

jupytercon-jupyterlab-training

JupyterCon 2018 JupyterLab Training
7
star
53

jupyterlab-translate

JupyterLab Language pack helper
Python
7
star
54

richoutput-js

Experimental investigation into a rendermime for es6 modules rendering rich output
Jupyter Notebook
7
star
55

jupyterlab-module-federation

Experimental playground for a JupyterLab extension system based on Module Federation
Python
5
star
56

jupyterlab-bot

JupyterLab Bot
Python
5
star
57

jupyterlab-probot

A probot for JupyterLab development
TypeScript
3
star
58

language-pack-cookiecutter

Template for Jupyterlab Language packs
Jinja
3
star
59

ux-research

3
star
60

.github

Community health files for the @JupyterLab organization
1
star
61

jupyter-builder

Build tools for JupyterLab (and remixes)
Python
1
star