Skip to main content

This is a little tiny wrapper around Git CLI

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

littlegit-0.2.0b8.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

littlegit-0.2.0b8-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file littlegit-0.2.0b8.tar.gz.

File metadata

  • Download URL: littlegit-0.2.0b8.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for littlegit-0.2.0b8.tar.gz
Algorithm Hash digest
SHA256 6f90e90d7e526553035a9ff366cc43620b3159d76aad962683f69979b9cab9e8
MD5 0561da3fdfc6aa749215737ae7c399d6
BLAKE2b-256 f3ef391138a77f5e10ddfc492554093ce7cff3f4edce5ae9917b35d98cc93acf

See more details on using hashes here.

File details

Details for the file littlegit-0.2.0b8-py3-none-any.whl.

File metadata

  • Download URL: littlegit-0.2.0b8-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for littlegit-0.2.0b8-py3-none-any.whl
Algorithm Hash digest
SHA256 f3c7d7ddfef78b134b314d57124dd2de94ac90cc468870afa3d78dca4d04adbb
MD5 bab22c90a8fe9c4e040aacc95f1f7b18
BLAKE2b-256 092cc9cf0ba213b8824ecd96f544fe39158cc783cefd21649933440dd1cce3ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page