gitoxide-python
Fast, safe, pure-Rust Git for Python — bindings to the gitoxide engine, and a modern alternative to GitPython.
gitoxide (the gix crate) is a next-generation, pure-Rust implementation of
Git. This project exposes that engine to Python through PyO3
and ships as pre-built wheels via maturin, so you get:
| GitPython | pygit2 | gitoxide-python | |
|---|---|---|---|
| Backend | shells out to the git CLI |
C libgit2 |
pure-Rust gix |
| Speed | slow (spawns a subprocess per call) | fast | fast (in-process, no subprocess) |
| Install | needs git on PATH |
needs a C toolchain / system libgit2 |
pip install, self-contained wheels |
| Memory safety | n/a (subprocess) | C | Rust |
Status: alpha. The binding surface is small but real. It currently covers read-oriented workflows (open/discover, HEAD, history walk, refs, branches, tags, blob reads) — the operations DevOps tooling reaches for most. See Scope for what is and isn't wrapped yet.
Installation
pip install gitoxide
Pre-built wheels are published for Linux (manylinux, x86_64 + aarch64), macOS
(x86_64 + Apple Silicon), and Windows — no Rust toolchain or system libgit2
required.
Quick start
import gitoxide
repo = gitoxide.open(".") # or gitoxide.discover(".")
print(repo.git_dir) # .../my-project/.git
print(repo.workdir) # .../my-project (None if bare)
print(repo.is_bare) # False
print(repo.head_name) # 'main' (None if detached)
# The commit at HEAD
head = repo.head_commit()
print(head.short_id, head.summary)
print(head.author.name, head.author.email, head.author.time)
# Walk history (reverse-chronological), like `git log`
for commit in repo.commits(max_count=10):
print(commit.short_id, commit.author.name, commit.summary)
# Resolve a revspec to an object id
print(repo.rev_parse("HEAD~2"))
print(repo.rev_parse("main"))
# Branches, tags, and all references
print(repo.branches()) # ['main', 'dev', ...]
print(repo.tags()) # ['v1.0.0', ...]
for ref in repo.references():
print(ref.name, "->", ref.target)
# Read a file's content at a revision
readme = repo.read_blob("HEAD:README.md")
print(readme.decode())
Migrating from GitPython
Common operations, side by side:
| GitPython | gitoxide-python |
|---|---|
from git import Repo |
import gitoxide |
repo = Repo(path) |
repo = gitoxide.open(path) |
Repo(path, search_parent_directories=True) |
gitoxide.discover(path) |
repo.head.commit |
repo.head_commit() |
repo.active_branch.name |
repo.head_name |
repo.iter_commits("main", max_count=10) |
repo.commits("main", max_count=10) |
repo.commit("HEAD~2") |
repo.commit("HEAD~2") |
repo.rev_parse("main").hexsha |
repo.rev_parse("main") |
[b.name for b in repo.branches] |
repo.branches() |
[t.name for t in repo.tags] |
repo.tags() |
c.hexsha, c.summary, c.author.name |
c.id, c.summary, c.author.name |
The key difference is what happens underneath: GitPython's iter_commits spawns
a git rev-list subprocess; gitoxide-python walks the object database
in-process in Rust.
API
Module functions
gitoxide.open(path) -> Repositorygitoxide.discover(path) -> Repository— searchpathand its parentsgitoxide.init(path, bare=False) -> Repositorygitoxide.gix_version() -> str
Repository
Properties: git_dir, workdir, is_bare, is_shallow, head_id,
head_name, head_is_detached.
Note:
head_nameandhead_is_detachedaccess theHEADreference and may raiseGitoxideErrorif it is inaccessible (e.g., corrupted repository). Other properties never raise.
Methods: head_commit(), rev_parse(spec), commit(rev),
commits(rev=None, max_count=None), references(), branches(), tags(),
read_blob(rev).
Commit
id, short_id, tree_id, message, summary, author, committer,
parents.
Signature
name, email, time (Unix seconds), offset (UTC offset seconds).
Reference
name, shorthand, target.
All errors (from any function or method) are raised as
gitoxide.GitoxideError.
Scope
This is a binding, not a reimplementation: it exposes a slice of what the gix
engine already does. Today that slice is:
- Wrapped: open / discover / init, HEAD, history walk, rev-parse, references, branches, tags, and blob reads.
- Not wrapped yet: diff & status, tree listing, writing commits and the index, blame, and clone / remote operations.
The engine supports much more; these are simply the parts this binding hasn't
surfaced yet. Issues and pull requests that expose more of gix are welcome —
see Contributing.
Contributing
The binding layer lives in a single src/lib.rs and maps closely
onto the gix API, so adding a method is usually a small, self-contained change.
Building from source requires a Rust toolchain (this is also the path used when installing the sdist on a platform without a pre-built wheel):
python -m venv .venv && source .venv/bin/activate
pip install maturin pytest
maturin develop # build the extension into the venv
pytest -q # run the test suite
cargo fmt --all # format Rust
cargo clippy --all-targets -- -D warnings
The tests generate a throwaway git repository on the fly (see
tests/conftest.py), so they need git on PATH but
touch nothing outside a temp directory.
License
Licensed under either of Apache License 2.0 or MIT license at your option, to match the upstream gitoxide project.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitoxide-0.2.0.tar.gz.
File metadata
- Download URL: gitoxide-0.2.0.tar.gz
- Upload date:
- Size: 28.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09378a64a7a4a636d35968272abae4e4b54e114cfe98c8b4f3561cd7e6453484
|
|
| MD5 |
acac4fe674d8b55fe3dff37115c8990f
|
|
| BLAKE2b-256 |
901ec623aea157ac7e03597cba6061e1114f5a8a407e0578505c8b8e36917b1a
|
Provenance
The following attestation bundles were made for gitoxide-0.2.0.tar.gz:
Publisher:
publish.yml on shenxianpeng/gitoxide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitoxide-0.2.0.tar.gz -
Subject digest:
09378a64a7a4a636d35968272abae4e4b54e114cfe98c8b4f3561cd7e6453484 - Sigstore transparency entry: 2258717841
- Sigstore integration time:
-
Permalink:
shenxianpeng/gitoxide@22b15412b66f51c81147a4e27f05cf7107381a0d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22b15412b66f51c81147a4e27f05cf7107381a0d -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitoxide-0.2.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: gitoxide-0.2.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45255e73b8e07368f5e2bd3065512cfc61397cbafa46ad9df9896e232e022554
|
|
| MD5 |
c1b3ec1c02002ac730196f59359c6c85
|
|
| BLAKE2b-256 |
a8d4b6c3713e658fb155199ed5b403117489e1127f7833a849569f5ceb5300b5
|
Provenance
The following attestation bundles were made for gitoxide-0.2.0-cp39-abi3-win_amd64.whl:
Publisher:
publish.yml on shenxianpeng/gitoxide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitoxide-0.2.0-cp39-abi3-win_amd64.whl -
Subject digest:
45255e73b8e07368f5e2bd3065512cfc61397cbafa46ad9df9896e232e022554 - Sigstore transparency entry: 2258717896
- Sigstore integration time:
-
Permalink:
shenxianpeng/gitoxide@22b15412b66f51c81147a4e27f05cf7107381a0d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22b15412b66f51c81147a4e27f05cf7107381a0d -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitoxide-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: gitoxide-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2991df04510a19cac482373491a1a63bc656ff4d8cb4eef974fb3d85f1159eb0
|
|
| MD5 |
d1a032ce10f84f3161df47fdd8b7e4f2
|
|
| BLAKE2b-256 |
9462b64bec1d57e1a23995fe4766959624c99cec4aa202b2702437b766d67336
|
Provenance
The following attestation bundles were made for gitoxide-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on shenxianpeng/gitoxide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitoxide-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
2991df04510a19cac482373491a1a63bc656ff4d8cb4eef974fb3d85f1159eb0 - Sigstore transparency entry: 2258718021
- Sigstore integration time:
-
Permalink:
shenxianpeng/gitoxide@22b15412b66f51c81147a4e27f05cf7107381a0d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22b15412b66f51c81147a4e27f05cf7107381a0d -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitoxide-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: gitoxide-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53b0048ac45482d48ee241cf13d0a35c0267fea6a3cf6a652bfb7a8b5dd92ecf
|
|
| MD5 |
6b616d41db30c01c3fd01fb1bc03a9d9
|
|
| BLAKE2b-256 |
26ebe231f9eebd0c818e3b8b64aca845600136fcffbc2bcfbcd88defca7b2919
|
Provenance
The following attestation bundles were made for gitoxide-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on shenxianpeng/gitoxide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitoxide-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
53b0048ac45482d48ee241cf13d0a35c0267fea6a3cf6a652bfb7a8b5dd92ecf - Sigstore transparency entry: 2258717980
- Sigstore integration time:
-
Permalink:
shenxianpeng/gitoxide@22b15412b66f51c81147a4e27f05cf7107381a0d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22b15412b66f51c81147a4e27f05cf7107381a0d -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitoxide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: gitoxide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b23790268aa4744c0657bf2ad77c067aab70e6738eafd52eb22c39bc968f768c
|
|
| MD5 |
529ddfa0af3a4612eed71dc9b6b588f9
|
|
| BLAKE2b-256 |
c921c95852babc8e19ea9fc6ea9202911eecd1cd5b479a86b326097ced326207
|
Provenance
The following attestation bundles were made for gitoxide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on shenxianpeng/gitoxide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitoxide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
b23790268aa4744c0657bf2ad77c067aab70e6738eafd52eb22c39bc968f768c - Sigstore transparency entry: 2258718042
- Sigstore integration time:
-
Permalink:
shenxianpeng/gitoxide@22b15412b66f51c81147a4e27f05cf7107381a0d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22b15412b66f51c81147a4e27f05cf7107381a0d -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitoxide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: gitoxide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8773d68cd175d2b02d74a88bcdd3ac886ef96580f2b986fd606a6baf1adbb4e5
|
|
| MD5 |
be0e88e6d866ab6e37883243edbd6b4a
|
|
| BLAKE2b-256 |
4128cd93d018fcd5be660e09ef908ca32117eb9cc701b53266194d2818939c1e
|
Provenance
The following attestation bundles were made for gitoxide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on shenxianpeng/gitoxide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitoxide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
8773d68cd175d2b02d74a88bcdd3ac886ef96580f2b986fd606a6baf1adbb4e5 - Sigstore transparency entry: 2258717947
- Sigstore integration time:
-
Permalink:
shenxianpeng/gitoxide@22b15412b66f51c81147a4e27f05cf7107381a0d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22b15412b66f51c81147a4e27f05cf7107381a0d -
Trigger Event:
push
-
Statement type: