Skip to content

Commit

Permalink
Document how to use vendored dependencies
Browse files Browse the repository at this point in the history
This adds a subsection to the end of the installation instructions
in the readme to explain how to cause the versions of the gitdb
and/or smmap dependencies that are vendored as submodules of the
GitPython repository to be used, instead of the PyPI versions, in
the infrequent case that this is desired.

This goes along with he removal of the logic that conditionally
modified sys.path, since that logic was intended to facilitate this
(and at one time had). The approach now documented in the readme
uses editable installs and does not involve modifying sys.path.

Because the need for this is uncommon, it may end up being moved
entirely into documentation in the doc/ directory in the future.
  • Loading branch information
EliahKagan committed Oct 20, 2023
1 parent 00aee49 commit 610c46d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ pip install -e ".[test]"

In the less common case that you do not want to install test dependencies, `pip install -e .` can be used instead.

#### With editable *dependencies* (not preferred, and rarely needed)

In rare cases, you may want to work on GitPython and one or both of its [gitdb](https://github.com/gitpython-developers/gitdb) and [smmap](https://github.com/gitpython-developers/smmap) dependencies at the same time, with changes in your local working copy of gitdb or smmap immediatley reflected in the behavior of your local working copy of GitPython. This can be done by making editable installations of those dependencies in the same virtual environment where you install GitPython.

If you want to do that *and* you want the versions in GitPython's git submodules to be used, then pass `-e git/ext/gitdb` and/or `-e git/ext/gitdb/gitdb/ext/smmap` to `pip install`. This can be done in any order, and in separate `pip install` commands or the same one, so long as `-e` appears before *each* path. For example, you can install GitPython, gitdb, and smmap editably in the currently active virtual environment this way:

```bash
pip install -e ".[test]" -e git/ext/gitdb -e git/ext/gitdb/gitdb/ext/smmap
```

The submodules must have been cloned for that to work, but that will already be the case if you have run `./init-tests-after-clone.sh`. You can use `pip list` to check which packages are installed editably and which are installed normally.

To reiterate, this approach should only rarely be used. For most development it is preferable to allow the gitdb and smmap dependencices to be retrieved automatically from PyPI in their latest stable packaged versions.

### Limitations

#### Leakage of System Resources
Expand Down

0 comments on commit 610c46d

Please sign in to comment.