Skip to main content

This python module is a wrapper around git (= the git binary file). It is ment as a simple interface to basic git functionality.

Project description

jk_git

Introduction

This python module is a wrapper around git (= the git binary file). It is ment as a simple interface to basic git functionality.

Information about this module can be found here:

Why this module?

git is an excellent version control system. It is widely used by developers to manage their source code in application development. Unfortunately using this functionality from within Python is a bit difficult as Python modules either don't provide some functionality required or aren't documented sufficiently. This module aims to fill this gap to some extent. Moreover it aims to do that in a way where the API is kept as universal as possible to allow similar support of other version control systems in the future.

Limitations of this module

This Python module does not aim to be a perfect wrapper around git, providing every single feature git provides. Nevertheless the functionality typically used will be covered in the future.

State of development

This module currently provides the following functionality:

  • check if a directory is a git working copy directory
  • retrieve the status: which files need to be committed?

Future versions of this module will provide the following functionality:

  • confirm changes to files in preparation of a commit
  • perform a commit
  • perform a push
  • create tags

How to use this module

Import this module

Please include this module into your application using the following code:

from jk_git import *

Check if a directory is a working copy directory

Sometimes it is convenient to check if a specific directory is a working copy directory:

print(GitWorkingCopy.hasWorkingCopy("/some/dir/....."))

Instantiate a working copy object to work with the working copy

In order to perform operations on the working copy you first have to instantiate an object representing your working copy:

wc = GitWorkingCopy("/some/dir/.....")

Display information about the current working copy

Example:

wc = GitWorkingCopy("/some/dir/.....")

print("Working copy root directory:", wc.rootDir)
print("Working copy is clean:", wc.isClean)
print("Working copy is not clean:", wc.isDirty)
print("Credentials are stored in git configuration:", wc.areCredentialsStored)
print("The upstream repository URL:", wc.remoteOrigin)

Display changes made to the current working copy

wc = GitWorkingCopy("/some/dir/.....")

for f in git.status(bIncludeIgnored=True):
	print("\t", f)

Contact Information

This is Open Source code. That not only gives you the possibility of freely using this code it also allows you to contribute. Feel free to contact the author(s) of this software listed below, either for comments, collaboration requests, suggestions for improvement or reporting bugs:

License

This software is provided under the following license:

  • Apache Software License 2.0

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

jk_git-0.2022.7.24.tar.gz (18.0 kB view details)

Uploaded Source

File details

Details for the file jk_git-0.2022.7.24.tar.gz.

File metadata

  • Download URL: jk_git-0.2022.7.24.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.10

File hashes

Hashes for jk_git-0.2022.7.24.tar.gz
Algorithm Hash digest
SHA256 d44e450c84c1319c541a889d631efeb93f899d8178e97eba835fdcdb1ba2145f
MD5 e9f92ba27ea307753e8e1168460f0ef4
BLAKE2b-256 1dbbef5ba71c6f0760ad4cac0c9c27abf95cbcb41ec2d3c734178a73046aa32a

See more details on using hashes here.

Supported by

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