Skip to main content

Prepare your Notebooks to be pushed to Git

Project description


CircleCI PyPI

Integrating Jupyter Notebooks to a git workflow.


(I highly recommend installing this into a conda environment) To install the extension and enable it just run the following commands:

pip install jupygit
jupyter serverextension enable --py jupygit --sys-prefix
jupyter nbextension install --py jupygit --sys-prefix
jupyter nbextension enable --py jupygit --sys-prefix


I've been working with Jupyter Notebooks for a while, and I always felt something dying inside me everytime I pushed a massive file to GitHub, only to have it overwritten by my next huge commit causing me to have unreadable diffs. I decided to create this extension that, as I previously stated, is a hack.

How? (and usage)

Let's say you are working on a file called Awesome.ipynb. What this extension will do once you press shiny new git button on your Notebook is:

  1. Shows a nice modal with an encouraging message.
  2. Renames your current file to Awesome-jupygit___.ipynb using Jupyter's API so that your kernel stays alive and you do not lose any work, we'll call this the "dirty" file.
  3. Adds the pattern *-jupygit___.ipynb to your .gitignore file, so that your "dirty" file does not show up as a new file in your git repository.
  4. Creates a copy of Awesome-jupygit___.ipynb but with the original name Awesome.ipynb, this copy is clean, no outputs and no execution_counts, we'll call this the "clean" file.
  5. Now is your turn to commit Awesome.ipynb, the "clean" file to source control!

Are you done pushing things to Git? Now close the dialog and this will happen:

  1. Delete the file Awesome.ipynb (do not worry! your kernel and work is safe in the "dirty" file).
  2. Rename Awesome-jupygit___.ipynb to Awesome.ipynb so that you can resume your work where you left it before being a good human and using source control.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupygit-0.4.0.tar.gz (5.6 kB view hashes)

Uploaded source

Built Distribution

jupygit-0.4.0-py3-none-any.whl (6.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page