CLI tool
gitpython-developers/GitPython avatar
gitpython-developers/GitPython

GitPython: the Python wrapper over the git executable, now in maintenance mode

GitPython is a python library used to interact with Git repositories.

5,198 stars1,017 forksPythonBSD-3-Clause

At a glance

What is it?
A pure Python library that talks to the git command line rather than reimplementing it, wrapping objects, refs and repositories in Python classes. The maintainers have put it in maintenance mode, and one recent release, 3.2.0, is labelled a security release.
Who is it for?
GitPython is still the quickest route from a Python script to git behaviour that is awkward in pure Python, and the object model is pleasant to work with, but it is now a project you adopt with maintenance mode in mind. By default it routes through the `git` executable, so a `PATH` that cannot find git is the first thing to configure, and the resource leak it documents makes it a poor fit for a long-lived daemon.
Can I use it commercially?
Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 26, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • gitpython-developers/GitPython5,198 ★ · +13
Star history
Repository2026-10-102026-11-26
gitpython-developers/GitPython5.2k5.2k

13 Stars in the last 47 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Installing from PyPI, and the git binary you already need

Installation is one line from PyPI, and the README recommends doing it inside a virtual environment:

sh
pip install GitPython

The requirement that catches people out is not the package, it is the `git` executable. GitPython needs the git command installed on the system and available in `PATH` for most operations. If it is not there, the environment variable `GIT_PYTHON_GIT_EXECUTABLE` is how you tell the library where to find it, which matters on Windows and in containers where git lives somewhere other than the usual path.

The stated requirements are Git 2.52 or newer and Python 3.8 or newer. The declared dependencies are equally short, and the file says so in full:

text
gitdb>=4.0.1,<5
typing-extensions>=3.10.0.2;python_version<"3.10"

Two dependencies tells you the architecture. `gitdb` gives fast object database access without shelling out for every read, and the typing extension is a conditional marker for Python versions that lack it. Everything else is the git binary.

The project metadata is unusually thorough for a library in maintenance mode. The classifiers claim Production/Stable status, an OS Independent classifier alongside POSIX, Windows and macOS, a Console environment, and Typed, and the declared Python support runs from 3.8 through 3.15. The version and the dependency list are both read from files at build time rather than hardcoded, which is why `VERSION`, `requirements.txt` and a `Makefile` with `release`, `force_release` and `clean` targets all exist at the repository root.

Why it shells out instead of reimplementing git

GitPython's stated position is that it provides abstractions of git objects for easy access to repository data, and that this is often backed by calling the git command line program. That word, often, is the honest part. The library is not a pure Python implementation of git, it is a typed object model over a subprocess.

The consequence is that you get git's actual behaviour, including its quirks, its configuration handling and its version differences, and you get it without reimplementing the parts of git that took two decades to get right. The README makes the scope explicit with `git-plumbing` and `git-porcelain`, the two layers of git's own command vocabulary.

The README now opens with GixPython, Python bindings for Gitoxide, an implementation of Git in Rust. GitPython's experimental Gix backend, currently unreleased, uses those bindings to run supported object reads, tree traversal, reference/index queries and commit history without launching Git subprocesses, while clone, fetch, push and direct `repo.git.<command>()` calls keep the Git CLI path.

That framing is worth holding on to. The library is a maintained adapter, not a foundation.

#### Development status

The README is explicit that the project is in maintenance mode, which means there will be no feature development unless it is contributed, no bug fixes unless they are relevant to the safety of users or contributed, and issues can wait up to a month for a response. The repository is open to contributions of all kinds as well as to new maintainers.

The resource leak that rules out daemons

The limitations section opens with a warning that GitPython is not suited to long-running processes such as daemons, because it tends to leak system resources. The stated reason is historical and specific: the library was written at a time when destructors, as implemented in the `__del__` method, still ran deterministically, and that assumption no longer holds under modern Python.

The README's remedy is to use `Repo` as a context manager (`with Repo(path) as repo:`), or call `repo.close()` explicitly when finished, to release its native repository handle and persistent Git object readers.

For an interactive script, a build step or a CI job, the leak matters less. For a long-running service that shells out to git repeatedly, the leak is a design constraint you have to design around, not a bug you can wait for a release to fix.

The recent releases are almost all security work

The three most recent releases are 3.1.62, published 2026-09-07, 3.2.0, published 2026-09-30 under the title "3.2.0 - Security", and 3.2.1, published 2026-10-14. For an adopter, the practical conclusion is to pin a recent version, and to treat anything older than 3.2.0 as predating a release the project itself labels as security work.

Working on the code rather than installing it

The contributor path is more involved than the install path, and the README is clear that one step must not be skipped. Cloning for development is documented as:

sh
git clone https://github.com/gitpython-developers/GitPython
cd GitPython
./init-tests-after-clone.sh

The README puts `./init-tests-after-clone.sh` directly after the clone command. On Windows the script runs in a Git Bash shell. There is also a documented `gh repo clone GitPython` path if you have the CLI and a fork by that name.

Test dependencies come from an editable install with extras, `pip install -e ".[test]"`, which the README says is taken care of if you installed that way.

One structural detail is worth knowing before you touch the tree. GitPython, gitdb and smmap all live in this one repository as independently packaged projects, and the README documents installing all three editable at once with `pip install -e smmap -e gitdb -e ".[test]"`. It marks that approach as not preferred and rarely needed, recommending instead that gitdb and smmap be retrieved from PyPI in their latest stable versions. The tree reflects that split, with `git/`, `gitdb/` and `smmap/` as sibling directories.

Editorial conclusion

GitPython is still the quickest route from a Python script to git behaviour that is awkward in pure Python, and the object model is pleasant to work with, but it is now a project you adopt with maintenance mode in mind. By default it routes through the `git` executable, so a `PATH` that cannot find git is the first thing to configure, and the resource leak it documents makes it a poor fit for a long-lived daemon. Pin a version, run it in a process you can restart, and if you are starting something new in 2026, the README's experimental Gix backend, built on Gitoxide, is worth reading about before you settle.

Frequently asked questions

How do I install GitPython?

From PyPI, inside a virtual environment: `pip install GitPython`. From a source checkout, run `pip install .` in the unpacked directory, or `pip install -e ".[test]"` for an editable install that includes the test dependencies. GitPython also needs the git executable on your PATH, or the GIT_PYTHON_GIT_EXECUTABLE environment variable pointing at it.

How can I run a Git command using Python?

GitPython is the library built for that. It provides abstractions over git objects, repositories and refs, and it is often backed by calling the git command line program rather than reimplementing git. Its declared dependencies are gitdb and, on Python before 3.10, typing-extensions.

Is GitPython still being developed?

The README states the project is in maintenance mode: no feature development unless contributed, no bug fixes unless they matter for user safety or are contributed, and issue responses that can take a month. The repository is still receiving releases, with 3.2.1 published on 2026-10-14, and it is open to new maintainers.

Can I use GitPython in a long-running daemon?

The README says not to, because it tends to leak system resources, having been written when __del__ destructors still ran deterministically. It advises using Repo as a context manager or calling repo.close() explicitly when finished, to release its native repository handle and persistent Git object readers.

Official sources

  1. gitpython-developers/GitPython on GitHub
  2. License: BSD-3-Clause
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/gitpython-developers-gitpython.svg)](https://hysenlabs.com/projects/gitpython-developers-gitpython)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/gitpython-developers-gitpython.svg)](https://hysenlabs.com/projects/gitpython-developers-gitpython)

Was this useful?