Skip to content

Commit 7b26b6d

Browse files
committed
Drop Python 3.7
1 parent cf43820 commit 7b26b6d

26 files changed

Lines changed: 550 additions & 631 deletions

.basedpyright/baseline.json

Lines changed: 492 additions & 500 deletions
Large diffs are not rendered by default.

.github/workflows/alpine-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
command -v git python
9090
git version
9191
python --version
92-
python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
92+
python -c 'import os, sys; print(f"{sys.platform=}, {os.name=}")'
9393
9494
- name: Test with pytest
9595
run: |

.github/workflows/cygwin-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
command -v git python
134134
git version
135135
python --version
136-
python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
136+
python -c 'import os, sys; print(f"{sys.platform=}, {os.name=}")'
137137
138138
- name: Test with pytest (${{ matrix.additional-pytest-args }})
139139
run: |

.github/workflows/dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ permissions:
1111

1212
jobs:
1313
test:
14-
runs-on: ${{ matrix.python-version == '3.7' && 'ubuntu-22.04' || 'ubuntu-latest' }}
14+
runs-on: ubuntu-latest
1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
project: [smmap, gitdb]
19-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"]
19+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"]
2020

2121
steps:
2222
- uses: actions/checkout@v7

.github/workflows/pythonpackage.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,14 @@ jobs:
1717
strategy:
1818
matrix:
1919
os-type: [ubuntu, macos, windows]
20-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"]
20+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"]
2121
exclude:
22-
- os-type: macos
23-
python-version: "3.7" # Not available for the ARM-based macOS runners.
2422
- os-type: macos
2523
python-version: "3.14t"
2624
- os-type: macos
2725
python-version: "3.15t"
2826
include:
29-
- os-ver: latest
30-
- os-type: ubuntu
31-
python-version: "3.7"
32-
os-ver: "22.04"
3327
- build-docs: true # We ensure documentation builds, except on very old interpreters.
34-
- python-version: "3.7"
35-
build-docs: false
3628
- python-version: "3.8"
3729
build-docs: false
3830
- experimental: false
@@ -43,7 +35,7 @@ jobs:
4335

4436
fail-fast: false
4537

46-
runs-on: ${{ matrix.os-type }}-${{ matrix.os-ver }}
38+
runs-on: ${{ matrix.os-type }}-latest
4739

4840
defaults:
4941
run:
@@ -140,7 +132,7 @@ jobs:
140132
command -v git python
141133
git version
142134
python --version
143-
python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
135+
python -c 'import os, sys; print(f"{sys.platform=}, {os.name=}")'
144136
145137
# For debugging hook tests on native Windows systems that may have WSL.
146138
- name: Show bash.exe candidates (Windows)
@@ -152,7 +144,7 @@ jobs:
152144
continue-on-error: true
153145

154146
- name: Check types with mypy
155-
if: matrix.python-version != '3.7' && matrix.python-version != '3.8'
147+
if: matrix.python-version != '3.8'
156148
run: |
157149
mypy --python-version="${PYTHON_VERSION%t}" # Version only, with no "t" for free-threaded.
158150
env:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ GitPython needs the `git` executable to be installed on the system and available
4444
by setting the `GIT_PYTHON_GIT_EXECUTABLE=<path/to/git>` environment variable.
4545

4646
- Git (1.7.x or newer)
47-
- Python >= 3.7
47+
- Python >= 3.8
4848

4949
The list of dependencies are listed in [`./requirements.txt`](https://github.com/gitpython-developers/GitPython/blob/main/requirements.txt) and [`./test-requirements.txt`](https://github.com/gitpython-developers/GitPython/blob/main/test-requirements.txt).
5050
The installer takes care of installing them for you.

doc/source/intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The object database implementation is optimized for handling large quantities of
1313
Requirements
1414
============
1515

16-
* `Python`_ >= 3.7
16+
* `Python`_ >= 3.8
1717
* `Git`_ 1.7.0 or newer
1818
It should also work with older versions, but it may be that some operations
1919
involving remotes will not work as expected.

fuzzing/fuzz-targets/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def read_lines_from_file(file_path: str) -> list:
4949
except FileNotFoundError:
5050
print(f"File not found: {file_path}")
5151
return []
52-
except IOError as e:
52+
except OSError as e:
5353
print(f"Error reading file {file_path}: {e}")
5454
return []
5555

git/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,6 @@ def refresh(path: Optional[PathLike] = None) -> None:
295295
try:
296296
refresh()
297297
except Exception as _exc:
298-
raise ImportError("Failed to initialize: {0}".format(_exc)) from _exc
298+
raise ImportError(f"Failed to initialize: {_exc}") from _exc
299299

300300
# } END initialize git executable path

git/config.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
Dict,
2929
Generic,
3030
List,
31+
OrderedDict,
3132
Sequence,
3233
Tuple,
3334
TypeVar,
@@ -47,15 +48,7 @@
4748
T_ConfigParser = TypeVar("T_ConfigParser", bound="GitConfigParser")
4849
T_OMD_value = TypeVar("T_OMD_value", str, bytes, int, float, bool, None)
4950

50-
if sys.version_info[:3] < (3, 7, 2):
51-
# typing.Ordereddict not added until Python 3.7.2.
52-
from collections import OrderedDict
53-
54-
OrderedDict_OMD = OrderedDict
55-
else:
56-
from typing import OrderedDict
57-
58-
OrderedDict_OMD = OrderedDict[str, List[T_OMD_value]] # type: ignore[assignment, misc]
51+
OrderedDict_OMD = OrderedDict[str, List[T_OMD_value]]
5952

6053
# -------------------------------------------------------------
6154

@@ -259,7 +252,7 @@ def setlast(self, key: str, value: Any) -> None:
259252

260253
self.getall(key)[-1] = value
261254

262-
def get(self, key: str, default: Union[_T, None] = None) -> Union[_T, None]:
255+
def get(self, key: str, default: Union[_T, None] = None) -> Union[_T, None]: # type: ignore[override]
263256
return super().get(self._key(key), [default])[-1]
264257

265258
def getall(self, key: str) -> List[_T]:
@@ -381,7 +374,7 @@ def __init__(
381374
Reference to repository to use if ``[includeIf]`` sections are found in
382375
configuration files.
383376
"""
384-
cp.RawConfigParser.__init__(self, dict_type=_OMD, allow_no_value=True)
377+
cp.RawConfigParser.__init__(self, dict_type=cast(Any, _OMD), allow_no_value=True)
385378
self._dict: Callable[..., _OMD]
386379
self._defaults: _OMD
387380
self._sections: _OMD
@@ -458,7 +451,7 @@ def release(self) -> None:
458451

459452
try:
460453
self.write()
461-
except IOError:
454+
except OSError:
462455
_logger.error("Exception during destruction of GitConfigParser", exc_info=True)
463456
except ReferenceError:
464457
# This happens in Python 3... and usually means that some state cannot be
@@ -759,7 +752,7 @@ def read(self) -> None: # type: ignore[override]
759752
with open(file_path, "rb") as fp:
760753
file_ok = True
761754
self._read(fp, fp.name)
762-
except IOError:
755+
except OSError:
763756
continue
764757

765758
# Read includes and append those that we didn't handle yet. We expect all
@@ -909,7 +902,7 @@ def write(self) -> None:
909902

910903
def _assure_writable(self, method_name: str) -> None:
911904
if self.read_only:
912-
raise IOError("Cannot execute non-constant method %s.%s" % (self, method_name))
905+
raise OSError(f"Cannot execute non-constant method {self}.{method_name}")
913906

914907
def add_section(self, section: "cp._SectionName") -> None:
915908
"""Assures added options will stay in order."""

0 commit comments

Comments
 (0)