Skip to content

Commit f7ef166

Browse files
[4.4] Add Support for Python 3.10 (#832)
Co-authored-by: Robsdedude <[email protected]>
1 parent 4d22919 commit f7ef166

File tree

14 files changed

+179
-43
lines changed

14 files changed

+179
-43
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Neo4j Driver Change Log
22

3+
## Version 4.4.9
4+
5+
- Python 3.10 support added
6+
7+
38
## Version 4.4
49

510
- Python 3.5 support has been dropped.

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repository contains the official Neo4j driver for Python.
66
Each driver release (from 4.0 upwards) is built specifically to work with a corresponding Neo4j release, i.e. that with the same `major.minor` version number.
77
These drivers will also be compatible with the previous Neo4j release, although new server features will not be available.
88

9+
+ Python 3.10 supported.
910
+ Python 3.9 supported.
1011
+ Python 3.8 supported.
1112
+ Python 3.7 supported.

TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Neo4j Driver Testing
22

33
To run driver tests, [Tox](https://tox.readthedocs.io) is required as well as at least one version of Python.
4-
The versions of Python supported by this driver are CPython 3.6, 3.7, 3.8, and 3.9.
4+
The versions of Python supported by this driver are CPython 3.6, 3.7, 3.8, 3.9, and 3.10.
55

66

77
## Unit Tests & Stub Tests

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Neo4j versions supported:
1212

1313
Python versions supported:
1414

15+
* Python 3.10 (added in driver version 4.4.9)
1516
* Python 3.9
1617
* Python 3.8
1718
* Python 3.7

neo4j/conf.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
from abc import ABCMeta
2323
from collections.abc import Mapping
24+
import sys
2425
import warnings
25-
from warnings import warn
2626

2727
from neo4j.meta import (
2828
deprecation_warn,
@@ -83,7 +83,9 @@ def __new__(mcs, name, bases, attributes):
8383
for k, v in attributes.items():
8484
if isinstance(v, DeprecatedAlias):
8585
deprecated_aliases[k] = v.new
86-
elif not k.startswith("_") and not callable(v):
86+
elif not (k.startswith("_")
87+
or callable(v)
88+
or isinstance(v, (staticmethod, classmethod))):
8789
fields.append(k)
8890
if isinstance(v, DeprecatedOption):
8991
deprecated_options[k] = v.value
@@ -286,8 +288,11 @@ def get_ssl_context(self):
286288

287289
# For recommended security options see
288290
# https://docs.python.org/3.6/library/ssl.html#protocol-versions
289-
ssl_context.options |= ssl.OP_NO_TLSv1 # Python 3.2
290-
ssl_context.options |= ssl.OP_NO_TLSv1_1 # Python 3.4
291+
if sys.version_info >= (3, 7):
292+
ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2 # Python 3.10
293+
else:
294+
ssl_context.options |= ssl.OP_NO_TLSv1 # Python 3.2
295+
ssl_context.options |= ssl.OP_NO_TLSv1_1 # Python 3.4
291296

292297

293298
if self.trust == TRUST_ALL_CERTIFICATES:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"Programming Language :: Python :: 3.7",
3838
"Programming Language :: Python :: 3.8",
3939
"Programming Language :: Python :: 3.9",
40+
"Programming Language :: Python :: 3.10",
4041
]
4142
entry_points = {
4243
"console_scripts": [

testkit/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ENV PYENV_ROOT /.pyenv
4040
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
4141

4242
# Setup python version
43-
ENV PYTHON_VERSIONS 3.6 3.7 3.8 3.9
43+
ENV PYTHON_VERSIONS 3.6 3.7 3.8 3.9 3.10
4444

4545
RUN for version in $PYTHON_VERSIONS; do \
4646
pyenv install $version:latest; \

tests/integration/conftest.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@
2525
from threading import RLock
2626

2727
import pytest
28-
import urllib
28+
import warnings
2929

30-
from neo4j import (
31-
GraphDatabase,
32-
)
33-
from neo4j.exceptions import ServiceUnavailable
30+
from neo4j import GraphDatabase
3431
from neo4j._exceptions import BoltHandshakeError
32+
from neo4j.exceptions import ServiceUnavailable
3533
from neo4j.io import Bolt
3634

3735
# import logging
@@ -76,7 +74,9 @@ def __init__(self, name=None, image=None, auth=None,
7674
n_cores=None, n_replicas=None,
7775
bolt_port=None, http_port=None, debug_port=None,
7876
debug_suspend=None, dir_spec=None, config=None):
79-
from boltkit.legacy.controller import _install, create_controller
77+
with warnings.catch_warnings():
78+
warnings.simplefilter("ignore", ImportWarning)
79+
from boltkit.legacy.controller import _install, create_controller
8080
assert image.endswith("-enterprise")
8181
release = image[:-11]
8282
if release == "snapshot":
@@ -189,7 +189,9 @@ def service(request):
189189
if existing_service:
190190
NEO4J_SERVICE = existing_service
191191
else:
192-
NEO4J_SERVICE = Neo4jService(auth=NEO4J_AUTH, image=request.param, n_cores=NEO4J_CORES, n_replicas=NEO4J_REPLICAS)
192+
with warnings.catch_warnings():
193+
warnings.simplefilter("ignore", DeprecationWarning)
194+
NEO4J_SERVICE = Neo4jService(auth=NEO4J_AUTH, image=request.param, n_cores=NEO4J_CORES, n_replicas=NEO4J_REPLICAS)
193195
NEO4J_SERVICE.start(timeout=300)
194196
yield NEO4J_SERVICE
195197
if NEO4J_SERVICE is not None:

tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ coverage
33
pytest
44
pytest-benchmark
55
pytest-cov
6-
pytest-mock
6+
pytest-mock~=3.6.1
77
teamcity-messages
88
pandas>=1.0.0

tests/stub/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@
2121

2222
import subprocess
2323
import os
24+
import warnings
2425

2526
from platform import system
2627
from threading import Thread
2728
from time import sleep
2829

29-
from boltkit.server.stub import BoltStubService
30+
with warnings.catch_warnings():
31+
warnings.simplefilter("ignore", ImportWarning)
32+
from boltkit.server.stub import BoltStubService
3033
from pytest import fixture
3134

3235
import logging

0 commit comments

Comments
 (0)