Skip to content

Commit b61edd8

Browse files
authored
Bump minimum Python version to 3.10 (#1153)
* Bump minimum Python version to 3.10 * Clean-up: lift code base to Python 3.10 * Error hard on some protocol violations When the announced record fields don't match the number of fields returned in the following `RECORD` messages, the driver should properly error and not silently swallow some fields. * Remove outdated linter&formatter exceptions
1 parent 89ca07c commit b61edd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+497
-486
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
44

55
## NEXT RELEASE
6-
- No breaking or major changes.
6+
- Python 3.7, 3.8, and 3.9 support has been dropped.
77

88

99
## Version 5.28

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ install the pre-commit hooks as described below instead. They will take care of
5858
updating the code if necessary.
5959

6060
Setting up the development environment:
61-
* Install Python 3.8+
61+
* Install Python 3.10+
6262
* Install the requirements
6363
```bash
6464
$ python3 -m pip install -U pip

README.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ breaking API changes.
1616

1717
See also: https://neo4j.com/developer/kb/neo4j-supported-versions/
1818

19-
+ Python 3.13 supported (since driver version 5.26.0).
20-
+ Python 3.12 supported (since driver version 5.14.0).
21-
+ Python 3.11 supported (since driver version 5.3.0).
19+
+ Python 3.13 supported.
20+
+ Python 3.12 supported.
21+
+ Python 3.11 supported.
2222
+ Python 3.10 supported.
23-
+ Python 3.9 supported.
24-
+ Python 3.8 supported.
25-
+ Python 3.7 supported.
2623

2724

2825
Installation

TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Neo4j Driver Testing
22
To run driver tests, [Tox](https://tox.readthedocs.io) is required as well as at least one version of Python.
3-
The versions of Python supported by this driver are CPython 3.7 - 3.12
3+
The versions of Python supported by this driver are CPython 3.10 - 3.13
44

55
## Testing with TestKit
66
TestKit is the shared test suite used by all official (and some community contributed) Neo4j drivers to ensure consistent and correct behavior across all drivers.

benchkit/app.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from __future__ import annotations
1818

19-
import sys
2019
import typing as t
2120
from contextlib import contextmanager
2221
from multiprocessing import Semaphore
@@ -44,10 +43,7 @@
4443
from .workloads import Workload
4544

4645

47-
if sys.version_info < (3, 8):
48-
T_App: te.TypeAlias = "Sanic"
49-
else:
50-
T_App: te.TypeAlias = "Sanic[Config, BenchKitContext]"
46+
T_App: te.TypeAlias = "Sanic[Config, BenchKitContext]"
5147

5248

5349
def create_app() -> T_App:

benchkit/workloads.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
import enum
2121
import typing as t
2222
from dataclasses import dataclass
23-
from typing import Iterator
2423

2524
import typing_extensions as te
2625

2726

2827
if t.TYPE_CHECKING:
28+
from collections.abc import Iterator
29+
2930
from neo4j import (
3031
AsyncDriver,
3132
AsyncManagedTransaction,

bin/make-unasync

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class CustomRule(unasync.Rule):
113113
# it's not pretty, but it works
114114
# typing.Awaitable[...] -> typing.Union[...]
115115
self.token_replacements["Awaitable"] = "Union"
116+
self.token_replacements["aiter"] = "iter"
117+
self.token_replacements["anext"] = "next"
116118

117119
def _unasync_tokens(self, tokens):
118120
# copy from unasync to fix handling of multiline strings
@@ -300,16 +302,15 @@ def apply_isort(paths):
300302

301303
def apply_changes(paths):
302304
def files_equal(path1, path2):
303-
with open(path1, "rb") as f1:
304-
with open(path2, "rb") as f2:
305+
with open(path1, "rb") as f1, open(path2, "rb") as f2:
306+
data1 = f1.read(1024)
307+
data2 = f2.read(1024)
308+
while data1 or data2:
309+
if data1 != data2:
310+
changed_paths[path1] = path2
311+
return False
305312
data1 = f1.read(1024)
306313
data2 = f2.read(1024)
307-
while data1 or data2:
308-
if data1 != data2:
309-
changed_paths[path1] = path2
310-
return False
311-
data1 = f1.read(1024)
312-
data2 = f2.read(1024)
313314
return True
314315

315316
changed_paths = {}

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Sphinx Documentation
33
====================
44

5-
Building the docs requires Python 3.8+
5+
Building the docs requires Python 3.10+
66

77
In project root
88
```

docs/source/async_api.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ Async API Documentation
66

77
.. versionadded:: 5.0
88

9-
.. warning::
10-
There are known issue with Python 3.8 and the async driver where it
11-
gradually slows down. Generally, it's recommended to use the latest
12-
supported version of Python for best performance, stability, and security.
13-
149
******************
1510
AsyncGraphDatabase
1611
******************

docs/source/index.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ See https://neo4j.com/developer/kb/neo4j-supported-versions/ for a driver-server
1818

1919
Python versions supported:
2020

21-
* Python 3.13 (added in driver version 5.26.0)
22-
* Python 3.12 (added in driver version 5.14.0)
23-
* Python 3.11 (added in driver version 5.3.0)
21+
* Python 3.13
22+
* Python 3.12
23+
* Python 3.11
2424
* Python 3.10
25-
* Python 3.9
26-
* Python 3.8
27-
* Python 3.7
2825

2926

3027
******

0 commit comments

Comments
 (0)