From 72e48aaea59738172ded5c964ddb4f06233ce9b7 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 9 Sep 2023 20:11:52 -0400 Subject: [PATCH] Update installation instructions in readme This changes the installation instructions in README.md to recommend "pip install ." instead of "python setup.py install". The former is compatible with Python 3.12 which doesn't have setuptools installed by default (so setup.py, which imports it, can be indirectly but not directly used). This also matches the corresponding change made in the installation unit test. While doing so, I've also clarified the instructions, and added the implied "cd" command as well as the "git fetch --tags" command in the position where a later section was recently updated to mention it should have been run. Using "pip install ." creates the opportunity to pass "-e" to make an editable install, which users who clone the repository to work on changes should do, because the effect of an editable install is only partially simulated by pytest, and so that manual testing of changes actually uses the changes intended for testing. This increases the length and detail of the instructions, so I've added h4 subsections to clarify the separations between them and make it easier for readers to find the part they're looking for. In doing so, I've reordered these subsections accordingly. Because greater detail can create the impression that all important steps are mentioned, I've made the general good advice to use a virtual environment explicit. For brevity, I have not added venv commands. --- README.md | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 94fcc76d9..c44985241 100644 --- a/README.md +++ b/README.md @@ -49,30 +49,49 @@ The installer takes care of installing them for you. ### INSTALL -If you have downloaded the source code: +GitPython and its required package dependencies can be installed in any of the following ways, all of which should typically be done in a [virtual environment](https://docs.python.org/3/tutorial/venv.html). -```bash -python setup.py install -``` +#### From PyPI -or if you want to obtain a copy from the Pypi repository: +To obtain and install a copy [from PyPI](https://pypi.org/project/GitPython/), run: ```bash pip install GitPython ``` -Both commands will install the required package dependencies. +(A distribution package can also be downloaded for manual installation at [the PyPI page](https://pypi.org/project/GitPython/).) + +#### From downloaded source code + +If you have downloaded the source code, run this from inside the unpacked `GitPython` directory: -A distribution package can be obtained for manual installation at: . +```bash +pip install . +``` -If you like to clone from source, you can do it like so: +#### By cloning the source code repository + +To clone the [the GitHub repository](https://github.com/gitpython-developers/GitPython) from source to work on the code, you can do it like so: ```bash git clone https://github.com/gitpython-developers/GitPython -git submodule update --init --recursive +cd GitPython +git fetch --tags ./init-tests-after-clone.sh ``` +If you are cloning [your own fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks), then replace the above `git clone` command with one that gives the URL of your fork. Or use this [`gh`](https://cli.github.com/) command (assuming you have `gh` and your fork is called `GitPython`): + +```bash +gh repo clone GitPython +``` + +Having cloned the repo, create and activate your [virtual environment](https://docs.python.org/3/tutorial/venv.html). Then make an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs): + +```bash +pip install -e . +``` + ### Limitations #### Leakage of System Resources