Skip to content

Commit b017b65

Browse files
codexByron
authored andcommitted
Build gitdb and smmap from the GitPython monorepo
Importing both dependency histories makes their live submodule copies redundant and invalidates tests that relied on those working trees as fixtures. Remove the gitlinks, keep the three distributions independent, and run dependency CI from their top-level monorepo directories. The regression check rejects any live gitlinks. Historical submodule tests now reconstruct local gitdb and smmap repositories from the preserved merge ancestry, so they remain offline and continue exercising the old layouts. Validated focused GitPython submodule and installation tests, gitdb and smmap suites, package builds, dependency lint, workflow YAML, and mypy.
1 parent a0cbcc2 commit b017b65

34 files changed

Lines changed: 144 additions & 371 deletions

.github/dependabot.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ updates:
66
schedule:
77
interval: weekly
88

9-
- package-ecosystem: gitsubmodule
10-
directory: "/"
11-
schedule:
12-
interval: weekly
13-
149
- package-ecosystem: pre-commit
1510
directory: "/"
1611
schedule:

.github/workflows/alpine-test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,13 @@ jobs:
6363
- name: Install project and test dependencies
6464
run: |
6565
. .venv/bin/activate
66-
pip install '.[test]'
66+
pip install ./smmap ./gitdb '.[test]'
6767
6868
- name: Show POSIX file ownership
6969
run: |
7070
ls -ld -- \
7171
"$(pwd)" \
7272
"$(pwd)/.git" \
73-
"$(pwd)/git/ext/gitdb" \
74-
"$(pwd)/git/ext/gitdb/.git" \
75-
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap" \
76-
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap/.git" \
7773
"${HOME:?HOME is not set}/.gitconfig" \
7874
2>&1 || true
7975

.github/workflows/cygwin-test.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ jobs:
5757
run: |
5858
git config --global --add safe.directory "$(pwd)"
5959
git config --global --add safe.directory "$(pwd)/.git"
60-
git config --global --add safe.directory "$(pwd)/git/ext/gitdb"
61-
git config --global --add safe.directory "$(pwd)/git/ext/gitdb/gitdb/ext/smmap"
6260
git config --global core.autocrlf false
6361
6462
- name: Prepare this repo for tests
@@ -84,7 +82,7 @@ jobs:
8482
8583
- name: Install project and test dependencies
8684
run: |
87-
pip install '.[test]'
85+
pip install ./smmap ./gitdb '.[test]'
8886
8987
- name: Show POSIX file ownership
9088
# Cygwin's `ls -ld` reports the NTFS Owner SID via Cygwin's SID-to-uid
@@ -96,12 +94,6 @@ jobs:
9694
ls -ld -- \
9795
"$(pwd)" \
9896
"$(pwd)/.git" \
99-
"$(pwd)/git/ext/gitdb" \
100-
"$(pwd)/git/ext/gitdb/.git" \
101-
"$(pwd)/.git/modules/gitdb" \
102-
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap" \
103-
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap/.git" \
104-
"$(pwd)/.git/modules/gitdb/modules/smmap" \
10597
"${HOME:?HOME is not set}/.gitconfig" \
10698
2>&1 || true
10799
@@ -114,12 +106,6 @@ jobs:
114106
$paths = @(
115107
"$pwd",
116108
"$pwd\.git",
117-
"$pwd\git\ext\gitdb",
118-
"$pwd\git\ext\gitdb\.git",
119-
"$pwd\.git\modules\gitdb",
120-
"$pwd\git\ext\gitdb\gitdb\ext\smmap",
121-
"$pwd\git\ext\gitdb\gitdb\ext\smmap\.git",
122-
"$pwd\.git\modules\gitdb\modules\smmap",
123109
"$env:USERPROFILE\.gitconfig"
124110
)
125111
foreach ($p in $paths) {

.github/workflows/dependencies.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Dependency packages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ${{ matrix.python-version == '3.7' && 'ubuntu-22.04' || 'ubuntu-latest' }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
project: [smmap, gitdb]
19+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"]
20+
21+
steps:
22+
- uses: actions/checkout@v7
23+
with:
24+
fetch-depth: 0
25+
- uses: actions/setup-python@v7
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
allow-prereleases: true
29+
- name: Install test dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install pytest flake8 ./smmap
33+
if test "${{ matrix.project }}" = gitdb; then python -m pip install ./gitdb; fi
34+
- name: Lint
35+
run: flake8 "${{ matrix.project }}/${{ matrix.project }}" --count --select=E9,F63,F7,F82 --show-source --statistics
36+
- name: Test
37+
run: |
38+
if test "${{ matrix.project }}" = gitdb; then
39+
GITDB_TEST_GIT_REPO_BASE="$(git rev-parse --git-common-dir)" pytest -v gitdb/gitdb/test
40+
else
41+
pytest -v smmap/smmap/test
42+
fi

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
9090
- name: Install project and test dependencies
9191
run: |
92-
pip install '.[test]'
92+
pip install ./smmap ./gitdb '.[test]'
9393
9494
- name: Show POSIX file ownership
9595
# Linux and macOS only. On Windows, Git Bash's `ls -ld` reports a
@@ -101,10 +101,6 @@ jobs:
101101
ls -ld -- \
102102
"$(pwd)" \
103103
"$(pwd)/.git" \
104-
"$(pwd)/git/ext/gitdb" \
105-
"$(pwd)/git/ext/gitdb/.git" \
106-
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap" \
107-
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap/.git" \
108104
"${HOME:?HOME is not set}/.gitconfig" \
109105
2>&1 || true
110106
@@ -118,10 +114,6 @@ jobs:
118114
$paths = @(
119115
"$pwd",
120116
"$pwd\.git",
121-
"$pwd\git\ext\gitdb",
122-
"$pwd\git\ext\gitdb\.git",
123-
"$pwd\git\ext\gitdb\gitdb\ext\smmap",
124-
"$pwd\git\ext\gitdb\gitdb\ext\smmap\.git",
125117
"$env:USERPROFILE\.gitconfig"
126118
)
127119
foreach ($p in $paths) {

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,13 @@ In the less common case that you do not want to install test dependencies, `pip
101101

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

104-
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 immediately 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.
105-
106-
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:
104+
GitPython, [gitdb](gitdb), and [smmap](smmap) live in this repository as independently packaged projects. To work on all three at once, install each one editably in the same virtual environment:
107105

108106
```sh
109-
pip install -e ".[test]" -e git/ext/gitdb -e git/ext/gitdb/gitdb/ext/smmap
107+
pip install -e smmap -e gitdb -e ".[test]"
110108
```
111109

112-
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.
110+
You can use `pip list` to check which packages are installed editably and which are installed normally.
113111

114112
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.
115113

doc/source/intro.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ and cloned using::
9797

9898
$ git clone https://github.com/gitpython-developers/GitPython git-python
9999

100-
Initialize all submodules to obtain the required dependencies with::
101-
102-
$ cd git-python
103-
$ git submodule update --init --recursive
104-
105100
Finally verify the installation by running unit tests::
106101

107102
$ python -m unittest

git/ext/gitdb

Lines changed: 0 additions & 1 deletion
This file was deleted.

gitdb/.github/dependabot.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)