Skip to content

cmeister2/gitpure

Repository files navigation

gitpure

CI PyPI version Python versions

A pure git Python library implemented in Rust using gitoxide. This library provides fast and memory-efficient git operations through Python bindings.

Features

  • Fast: Built with Rust and gitoxide for optimal performance
  • Memory efficient: Leverages Rust's memory management
  • Cross-platform: Works on Linux, macOS, and Windows
  • Pure Python interface: Easy to use Python API
  • Safe: Thread-safe operations with Rust's ownership model

Installation

Install from PyPI:

pip install gitpure

Quick Start

import gitpure

# Clone a repository (with worktree)
repo = gitpure.Repo.clone_from("https://github.com/user/repo.git", "/path/to/local/repo")

# Clone a bare repository
bare_repo = gitpure.Repo.clone_from("https://github.com/user/repo.git", "/path/to/bare/repo", bare=True)

# Get the git directory path
git_dir = repo.git_dir
print(f"Git directory: {git_dir}")

Development

Prerequisites

  • Python 3.8+
  • Rust 1.70+
  • maturin

Building from Source

# Clone the repository
git clone https://github.com/cmeister2/gitpure.git
cd gitpure

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install maturin
pip install maturin

# Build and install in development mode
maturin develop

# Or build wheel
maturin build --release

Running Tests

# Install test dependencies
pip install pytest

# Run tests
pytest tests/

Release process

Releases are fully automated with semantic-release. The pipeline will:

  1. Inspect the commit history on main using Conventional Commits to determine the next semantic version.
  2. Prepare the Rust crate, using the next version (or a dev version if available).
  3. Build wheels and source distributions with maturin and attach them to the GitHub release.
  4. Publish the distribution artifacts to PyPI.

To keep releases working you must:

  • Continue to write commits that follow the Conventional Commits specification (feat:, fix:, etc.).

You can trigger a release by merging changes into main.

Architecture

gitpure is built on top of:

  • gitoxide: A pure Rust implementation of git
  • PyO3: Python bindings for Rust
  • maturin: Build tool for Python extensions written in Rust

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for your changes
  5. Ensure all tests pass (pytest)
  6. Commit your changes (git commit -m 'Add some amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A way of interacting with Git repositories in Python without installing Git

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •