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.

  • Plumbing: This is a lower-level interface with verbs that were designed to be chained together UNIX style.
  • Porcelain: This is the higher-level API, what an end-user of git would use – fetch, pull, push etc.

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.

I'll tell you when I post stuff.

Subscribe to get my latest posts by email.