Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork966
intro.rst
intro.rst
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
It provides abstractions of git objects for easy access of repository data, and additionally allows you to access the git repository more directly using either a pure python implementation, or the faster, but more resource intensive git command implementation.
The object database implementation is optimized for handling large quantities of objects and large datasets, which is achieved by using low-level structures and data streaming.
- Python 2.7 or newer
- Since GitPython 2.0.0. Please note that python 2.6 is still reasonably well supported, but mightdeteriorate over time. Support is provided on a best-effort basis only.
- Git 1.7.0 or newer
- It should also work with older versions, but it may be that some operationsinvolving remotes will not work as expected.
- GitDB - a pure python git database implementation
- Python Nose - used for running the tests
- Mock by Michael Foord used for tests. Requires version 0.5
Installing GitPython is easily done usingpip. Assuming it isinstalled, just run the following from the command-line:
# pip install gitpythonThis command will download the latest version of GitPython from thePython Package Index and install itto your system. More information aboutpip and pypi can be foundhere:
Alternatively, you can install from the distribution using thesetup.pyscript:
# python setup.py installNote
In this case, you have to manually installGitDB as well. It would be recommended to use the:ref:`git source repository <source-code-label>` in that case.
GitPython is not suited for long-running processes (like daemons) as it tends toleak system resources. It was written in a time where destructors (as implementedin the __del__ method) still ran deterministically.
In case you still want to use it in such a context, you will want to search thecodebase for __del__ implementations and call these yourself when you see fit.
Another way assure proper cleanup of resources is to factor out GitPython into aseparate process which can be dropped periodically.
This means that support for these platforms is likely to worsen over timeas they are kept alive solely by their users, or not.
- :ref:`tutorial-label` - This tutorial provides a walk-through of some ofthe basic functionality and concepts used in GitPython. It, however, is notexhaustive so you are encouraged to spend some time in the:ref:`api_reference_toplevel`.
An organized section of the GitPython API is at:ref:`api_reference_toplevel`.
GitPython's git repo is available on GitHub, which can be browsed at:
and cloned using:
$ git clone https://github.com/gitpython-developers/GitPython git-python
Initialize all submodules to obtain the required dependencies with:
$ cd git-python$ git submodule update --init --recursive
Finally verify the installation by running thenose powered unit tests:
$ nosetests
Please use stackoverflow for questions, and don't forget to tag it with gitpython to assure the right people see the question in a timely manner.
http://stackoverflow.com/questions/tagged/gitpython
The issue tracker is hosted by github:
https://github.com/gitpython-developers/GitPython/issues
GitPython is licensed under the New BSD License. See the LICENSE file formore information.