Dulwich – a native python way to access Git repositories
Ever wanted to manipulate Git repositories directly in python? Well, okay… I haven’t really myself, but in writing about Google Code’s support for git yesterday, I noticed that they are using Dulwich, a native python implementation of git. Rather than wrapping command-line git with python scripts, Dulwich is a python module giving you direct access to a git repository. As shown in the Dulwich tutorial, creating a new repo is simply this:
>>> from dulwich.repo import Repo >>> from os import mkdir >>> mkdir("myrepo") >>> repo = Repo.init("myrepo") >>> repo <Repo at 'myrepo'>
Once a repo is created (or you connect to an existing repo), you can do what you would do with git at the command line: adding files to the repo, committing files, and changing files.
While I don’t know that I personally will use this… it’s very cool that Dulwich is out there for python programmers who want to interact with git repos. Very cool to see!