Skip to content

Commit ded846d

Browse files
committed
Merge branch 'setup'
2 parents c8e303f + 5343aa0 commit ded846d

12 files changed

+175
-89
lines changed

Diff for: .github/workflows/cygwin-test.yml

+29-14
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,53 @@ jobs:
1212
SHELLOPTS: igncr
1313
TMP: "/tmp"
1414
TEMP: "/tmp"
15+
defaults:
16+
run:
17+
shell: bash.exe --noprofile --norc -exo pipefail -o igncr "{0}"
1518

1619
steps:
1720
- name: Force LF line endings
1821
run: git config --global core.autocrlf input
22+
1923
- uses: actions/checkout@v4
2024
with:
21-
fetch-depth: 9999
25+
fetch-depth: 0
26+
submodules: recursive
27+
2228
- uses: cygwin/cygwin-install-action@v4
2329
with:
2430
packages: python39 python39-pip python39-virtualenv git
31+
32+
- name: Show python and git versions
33+
run: |
34+
/usr/bin/python --version
35+
/usr/bin/git version
36+
2537
- name: Tell git to trust this repo
26-
shell: bash.exe -eo pipefail -o igncr "{0}"
2738
run: |
28-
/usr/bin/git config --global --add safe.directory "$(pwd)"
29-
- name: Install dependencies and prepare tests
30-
shell: bash.exe -eo pipefail -o igncr "{0}"
39+
/usr/bin/git config --global --add safe.directory "$(pwd)"
40+
41+
- name: Prepare this repo for tests
3142
run: |
32-
set -x
33-
/usr/bin/python -m pip install --upgrade pip setuptools wheel
34-
/usr/bin/python --version; /usr/bin/git --version
35-
/usr/bin/git submodule update --init --recursive
36-
/usr/bin/git fetch --tags
37-
/usr/bin/python -m pip install -r requirements.txt
38-
/usr/bin/python -m pip install -r test-requirements.txt
3943
TRAVIS=yes ./init-tests-after-clone.sh
44+
45+
- name: Further prepare git configuration for tests
46+
run: |
4047
/usr/bin/git config --global user.email "[email protected]"
4148
/usr/bin/git config --global user.name "Travis Runner"
4249
# If we rewrite the user's config by accident, we will mess it up
4350
# and cause subsequent tests to fail
4451
cat test/fixtures/.gitconfig >> ~/.gitconfig
52+
53+
- name: Update PyPA packages
54+
run: |
55+
/usr/bin/python -m pip install --upgrade pip setuptools wheel
56+
57+
- name: Install project and test dependencies
58+
run: |
59+
/usr/bin/python -m pip install ".[test]"
60+
4561
- name: Test with pytest
46-
shell: bash.exe -eo pipefail -o igncr "{0}"
4762
run: |
63+
set +x
4864
/usr/bin/python -m pytest
49-
continue-on-error: false

Diff for: .github/workflows/pythonpackage.yml

+36-17
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,70 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
18+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
19+
include:
20+
- experimental: false
21+
- python-version: "3.12"
22+
experimental: true
23+
defaults:
24+
run:
25+
shell: /bin/bash --noprofile --norc -exo pipefail {0}
1926

2027
steps:
2128
- uses: actions/checkout@v4
2229
with:
23-
fetch-depth: 9999
30+
fetch-depth: 0
31+
submodules: recursive
32+
2433
- name: Set up Python ${{ matrix.python-version }}
2534
uses: actions/setup-python@v4
2635
with:
2736
python-version: ${{ matrix.python-version }}
28-
- name: Install dependencies and prepare tests
29-
run: |
30-
set -x
37+
allow-prereleases: ${{ matrix.experimental }}
3138

32-
python -m pip install --upgrade pip setuptools wheel
33-
python --version; git --version
34-
git submodule update --init --recursive
35-
git fetch --tags --force
39+
- name: Show python and git versions
40+
run: |
41+
python --version
42+
git version
3643
37-
pip install -r requirements.txt
38-
pip install -r test-requirements.txt
44+
- name: Prepare this repo for tests
45+
run: |
3946
TRAVIS=yes ./init-tests-after-clone.sh
4047
48+
- name: Prepare git configuration for tests
49+
run: |
4150
git config --global user.email "[email protected]"
4251
git config --global user.name "Travis Runner"
4352
# If we rewrite the user's config by accident, we will mess it up
4453
# and cause subsequent tests to fail
4554
cat test/fixtures/.gitconfig >> ~/.gitconfig
4655
56+
- name: Update PyPA packages
57+
run: |
58+
python -m pip install --upgrade pip
59+
if pip freeze --all | grep --quiet '^setuptools=='; then
60+
# Python prior to 3.12 ships setuptools. Upgrade it if present.
61+
python -m pip install --upgrade setuptools
62+
fi
63+
python -m pip install --upgrade wheel
64+
65+
- name: Install project and test dependencies
66+
run: |
67+
pip install ".[test]"
68+
4769
- name: Check types with mypy
48-
# With new versions of pypi new issues might arise. This is a problem if there is nobody able to fix them,
49-
# so we have to ignore errors until that changes.
50-
continue-on-error: true
5170
run: |
52-
set -x
5371
mypy -p git
72+
# With new versions of mypy new issues might arise. This is a problem if there is nobody able to fix them,
73+
# so we have to ignore errors until that changes.
74+
continue-on-error: true
5475

5576
- name: Test with pytest
5677
run: |
57-
set -x
5878
pytest
5979
continue-on-error: false
6080

6181
- name: Documentation
6282
run: |
63-
set -x
6483
pip install -r doc/requirements.txt
6584
make -C doc html

Diff for: Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ release: clean
1515
make force_release
1616

1717
force_release: clean
18-
git push --tags origin main
19-
python3 setup.py sdist bdist_wheel
18+
# IF we're in a virtual environment, add build tools
19+
test -z "$$VIRTUAL_ENV" || pip install -U build twine
20+
python3 -m build --sdist --wheel
2021
twine upload dist/*
22+
git push --tags origin main

Diff for: README.md

+75-23
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,51 @@ The installer takes care of installing them for you.
4949

5050
### INSTALL
5151

52-
If you have downloaded the source code:
52+
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).
5353

54-
```bash
55-
python setup.py install
56-
```
54+
#### From PyPI
5755

58-
or if you want to obtain a copy from the Pypi repository:
56+
To obtain and install a copy [from PyPI](https://pypi.org/project/GitPython/), run:
5957

6058
```bash
6159
pip install GitPython
6260
```
6361

64-
Both commands will install the required package dependencies.
62+
(A distribution package can also be downloaded for manual installation at [the PyPI page](https://pypi.org/project/GitPython/).)
63+
64+
#### From downloaded source code
65+
66+
If you have downloaded the source code, run this from inside the unpacked `GitPython` directory:
67+
68+
```bash
69+
pip install .
70+
```
6571

66-
A distribution package can be obtained for manual installation at: <http://pypi.python.org/pypi/GitPython>.
72+
#### By cloning the source code repository
6773

68-
If you like to clone from source, you can do it like so:
74+
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:
6975

7076
```bash
7177
git clone https://github.com/gitpython-developers/GitPython
72-
git submodule update --init --recursive
78+
cd GitPython
79+
git fetch --tags
7380
./init-tests-after-clone.sh
7481
```
7582

83+
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`):
84+
85+
```bash
86+
gh repo clone GitPython
87+
```
88+
89+
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):
90+
91+
```bash
92+
pip install -e ".[test]"
93+
```
94+
95+
In the less common case that you do not want to install test dependencies, `pip install -e .` can be used instead.
96+
7697
### Limitations
7798

7899
#### Leakage of System Resources
@@ -101,20 +122,49 @@ On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `
101122
exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
102123
with MINGW's.
103124

104-
Ensure testing libraries are installed.
105-
In the root directory, run: `pip install -r test-requirements.txt`
125+
#### Install test dependencies
106126

107-
To lint, run: `pre-commit run --all-files`
127+
Ensure testing libraries are installed. This is taken care of already if you installed with:
108128

109-
To typecheck, run: `mypy -p git`
129+
```bash
130+
pip install -e ".[test]"
131+
```
110132

111-
To test, run: `pytest`
133+
Otherwise, you can run:
112134

113-
For automatic code formatting run: `black git`
135+
```bash
136+
pip install -r test-requirements.txt
137+
```
138+
139+
#### Test commands
140+
141+
To test, run:
142+
143+
```bash
144+
pytest
145+
```
146+
147+
To lint, run:
148+
149+
```bash
150+
pre-commit run --all-files
151+
```
152+
153+
To typecheck, run:
154+
155+
```bash
156+
mypy -p git
157+
```
158+
159+
For automatic code formatting, run:
160+
161+
```bash
162+
black git
163+
```
114164

115-
Configuration for flake8 is in the ./.flake8 file.
165+
Configuration for flake8 is in the `./.flake8` file.
116166

117-
Configurations for mypy, pytest and coverage.py are in ./pyproject.toml.
167+
Configurations for `mypy`, `pytest`, `coverage.py`, and `black` are in `./pyproject.toml`.
118168

119169
The same linting and testing will also be performed against different supported python versions
120170
upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled).
@@ -138,13 +188,15 @@ Please have a look at the [contributions file][contributing].
138188

139189
### How to make a new release
140190

141-
- Update/verify the **version** in the `VERSION` file
142-
- Update/verify that the `doc/source/changes.rst` changelog file was updated
143-
- Commit everything
144-
- Run `git tag -s <version>` to tag the version in Git
145-
- Run `make release`
191+
- Update/verify the **version** in the `VERSION` file.
192+
- Update/verify that the `doc/source/changes.rst` changelog file was updated.
193+
- Commit everything.
194+
- Run `git tag -s <version>` to tag the version in Git.
195+
- _Optionally_ create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) using `venv` or `virtualenv`.\
196+
(When run in a virtual environment, the next step will automatically take care of installing `build` and `twine` in it.)
197+
- Run `make release`.
146198
- Close the milestone mentioned in the _changelog_ and create a new one. _Do not reuse milestones by renaming them_.
147-
- Got to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
199+
- Go to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
148200

149201
### How to verify a release (DEPRECATED)
150202

Diff for: VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.35
1+
3.1.36

Diff for: doc/source/changes.rst

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Changelog
33
=========
44

5+
3.1.36
6+
======
7+
8+
Note that this release should be a no-op, it's mainly for testing the changed release-process.
9+
10+
See the following for all changes.
11+
https://github.com/gitpython-developers/gitpython/milestone/66?closed=1
12+
513
3.1.35
614
======
715

Diff for: init-tests-after-clone.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/bin/bash -e
1+
#!/usr/bin/env bash
2+
3+
set -e
24

35
if [[ -z "$TRAVIS" ]]; then
4-
read -p "This operation will destroy locally modified files. Continue ? [N/y]: " answer
6+
read -rp "This operation will destroy locally modified files. Continue ? [N/y]: " answer
57
if [[ ! $answer =~ [yY] ]]; then
68
exit 2
79
fi
@@ -13,4 +15,4 @@ git reset --hard HEAD~1
1315
git reset --hard HEAD~1
1416
git reset --hard HEAD~1
1517
git reset --hard __testing_point__
16-
git submodule update --init --recursive
18+
git submodule update --init --recursive

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
2+
requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.pytest.ini_options]

Diff for: requirements-dev.txt

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# libraries for additional local testing/linting - to be added to test-requirements.txt when all pass
55

66
flake8-type-checking;python_version>="3.8" # checks for TYPE_CHECKING only imports
7-
black
87

98
pytest-icdiff
109
# pytest-profiling

0 commit comments

Comments
 (0)