Skip to main content

Get git information repository, directly from .git

Project description

python-git-info

A very simple project to get information from the git repository of your project. This package does not have any dependencies; it reads directly the data from the .git repository.

Installation

Just do a pip install gitinfo, or copy the gitinfo/gitinfo.py file to your project directly.

Usage

This app will search the current directory for a .git directory (which is always contained inside the root directory of a project). If one is found it will be used; else it will search the parent directory recursively until a .git is found.

There's a single function name get_git_info() with an optional dir parameter. If you leave it empty it will start the .git directory search from the current directory, if you provide a value for dir it will start from that directory. The get_git_info will return a dictionary with the following structure if everything works ok or None if something fishy happend or no .git folder was found:

  {
    'parent_commit': 'd54743b6e7cf9dc36354fe2907f2f415b9988198', 
    'message': 'commit: Small restructuring\n', 
    'commiter': 'Serafeim <email@email.com>', 
    'commit_time': '2018-11-14 13:52:34', 
    'commit': '9e1eec364ad24df153ca36d1da8405bb6379e03b'
  }

Changes

0.3

  • Make it work with '..'

0.2

  • Initial

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

python-git-info-0.3.0.tar.gz (2.7 kB view details)

Uploaded Source

File details

Details for the file python-git-info-0.3.0.tar.gz.

File metadata

  • Download URL: python-git-info-0.3.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.5.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12

File hashes

Hashes for python-git-info-0.3.0.tar.gz
Algorithm Hash digest
SHA256 da44d3ed90aa003248db406e4d6c2f25643024f670ae4283eead7db80b9ef379
MD5 57d7f28d3c1cc29b9356b5afbc404775
BLAKE2b-256 d4f729ec8127b27afd4bb6257e0d01f5e94cbf5c150def28395a6e1b3ef857ba

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