Never modify sys.path by EliahKagan · Pull Request #1720 · gitpython-developers/GitPython (original) (raw)

Fixes #1717

Main changes

This removes the logic that, under some (most) circumstances when not using a version from PyPI, would insert the location of the gitdb git-submodule near the front of sys.path.

As noted in #1717, the specific way this was being done was not causing the git-submodule's version of gitdb to actually be used. But it was still modifying sys.path, which this now prevents.

Test changes

The installation test, which had verified the insertion into sys.path, is modified accordingly, except that for now the check that the very first sys.path entry is undisturbed is kept in place.

Because we do not yet have native Windows tests on CI, and it is the sort of test that is likely to reveal OS-specific problems (it had ben broken on Windows in the past), I have verified locally that this test still passes on a native Windows system (though I only tried it with Python 3.12.)

Documentation changes

Per #1717 (comment), I've also added a subsection at the end of the installation instructions in README.md to explain how the gitdb and smmap dependencies can be installed editably in the uncommon case that using them rather than packages installed from PyPI is desired.

This new material in the readme should probably be moved into the documentation in doc/ later, once that documentation is revised and updated.

I have proposed a roughly corresponding change to gitdb in gitdb#102.