Skip to main content

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

Metadata

Release files for jk-git 0.2022.7.24

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

Source distribution (sdist)

Source distribution for jk-git 0.2022.7.24
File Size Uploaded
jk_git-0.2022.7.24.tar.gz 18.0 kB Details

Release files / jk_git-0.2022.7.24.tar.gz

Download URL jk_git-0.2022.7.24.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d44e450c84c1319c541a889d631efeb93f899d8178e97eba835fdcdb1ba2145f
BLAKE2b-256 checksum
How to use checksums
1dbbef5ba71c6f0760ad4cac0c9c27abf95cbcb41ec2d3c734178a73046aa32a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2022.7.24 This release

1 release file

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