README

This repository has been archived and is no longer maintained

Use gitpython instead

gitspy

Status Inactive License PyPI Build CodeQL pre-commit.ci status codecov.io readthedocs.org python3.8 Black isort docformatter pylint Security Status Known Vulnerabilities gitspy

Intuitive Git for Python

Install

Dependencies: git ^2.0.0 (tested)

pip install gitspy

Development

poetry install

Example Usage

Get branch

Capture will store stdout, which can then be consumed by calling git.stdout()

Default is to return returncode and print stdout and stderr to console

>>> import gitspy
>>> git = gitspy.Git()
>>> git.init(capture=True)  # ['...']
0

Consume stdout (a list containing a str)

>>> len(git.stdout())  # []
1

No commands have been called yet since last call to stdout so stdout is empty

>>> len(git.stdout())  # []
0

Stdout can be accrued

>>> git.init(capture=True)  # ['...']
0
>>> git.init(capture=True)  # ['...', '...']
0
>>> len(git.stdout())  # []
2

Stdout is consumed

>>> len(git.stdout())  # []
0

Get commit hash

>>> git.rev_parse("HEAD", capture=True)  # ['...']
0
>>> len(git.stdout()[0])  # []
40