Skip to main content

Littlegit

A very little Python wrapper around Git CLI.

Littlegit doesn't need any external dependency except for the Git binary to be installed in your system.

All the current, past and future commands and options of Git are fully supported.

Installation

Install Littlegit with pip:

pip install littlegit

Usage

To use Littlegit is very simple, it follows a very simple rule to map Git's commands to Littlegit's API:

  • every Git command is a method
  • every argument is a method's argument
  • every option is a method's keywords

Lets explain this with an example of initialising a local repository, adding a file and commiting:

from pathlib import Path

from littlegit import Git

repo = Git(Path("/my/local/repo"))
repo.init()  # git init /my/local/repo

open("myfile", "w").close()

repo.add("myfile")  # git add myfile
repo.commit(message="this is my first commit")  # git commit --message "this is my first commit"
repo.remote("add", "origin", "<my_remote_repo>")  # git remote add origin <my_remote_repo>
repo.push("origin", "master")  # git push origin master
print(repo.log(_1=True))  # get only the last log message

All the methods return the output if the Git command:

output = repo.branch(remote=True)  # git branch --remote
print(output)
origin/HEAD -> origin/master
origin/master

Tests

To run the unit tests install the development dependencies and then run PyTest:

pip install -r requirements_dev.txt
pytest tests.py

Metadata

Release files for littlegit 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for littlegit 0.2.0
File Size Uploaded Provenance Actions
littlegit-0.2.0.tar.gz 2.8 kB Without provenance Details for littlegit-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for littlegit 0.2.0
File Interpreter ABI Platform Actions
littlegit-0.2.0-py3-none-any.whl Python 3 none any Details for littlegit-0.2.0-py3-none-any.whl

Total release size: 6.5 kB

Release files / littlegit-0.2.0.tar.gz

Download URL littlegit-0.2.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ec26563185767e562efa2b39ba6cc79c75e757c39e74a470491c570c7d9b385a
BLAKE2b-256 checksum
How to use checksums
f11f4cfb870949ccc634b22bcb314054b4f727365ef4c9da2189dc3fb9baeebb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.1

Release files / littlegit-0.2.0-py3-none-any.whl

Download URL littlegit-0.2.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dde799deb31691d3396a79966c29e9402d336718301a08ed7c61b3058dceffab
BLAKE2b-256 checksum
How to use checksums
695c5ecd186b92f69ca88b196f3b85829f20872d4e011c1a022bdb2a63b3f2c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.1

Security for littlegit 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page