Dulwich: Python library for managing git

July 10, 2017

Dulwich Docs
Dulwich API Docs

Context
I need to update my static site using Python, which is hosted on Netlify, and is updated via Git.

I need just the porcelain level api to automate a few commands.

Dulwich

I found a few libraries for it, but Dulwich seemed to be the simplest for what I needed.
I wrote light wrappers around this library to include it my package. Basically, it should end up looking like this:

import <packagename>.website as website

website.clone()

website.update_inventory()      #still need to write this part

website.add()
website.commit()
website.push()

Essentially, I need a simple api to use in my run.py, which allows me to update the inventory and push it back to Netlify to trigger the build.
At the moment, run.py is executed everyday through a cronjob.