Skip to content

Commit c4f57c1

Browse files
committed
Bump driver version to 4.4, drop Python 3.5 support
1 parent 76b399d commit c4f57c1

File tree

14 files changed

+76
-74
lines changed

14 files changed

+76
-74
lines changed

CHANGELOG.md

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

3+
## Version 4.4
4+
5+
- Python 3.5 support has been dropped.
6+
37

48
## Version 4.3
59

@@ -35,4 +39,4 @@
3539
+ Python 3.2 support has been dropped.
3640
+ Python 3.1 support has been dropped.
3741
+ Python 3.0 support has been dropped.
38-
+ Python 2.7 support has been dropped.
42+
+ Python 2.7 support has been dropped.

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ These drivers will also be compatible with the previous Neo4j release, although
1010
+ Python 3.8 supported.
1111
+ Python 3.7 supported.
1212
+ Python 3.6 supported.
13-
+ Python 3.5 supported.
1413

1514
Python 2.7 support has been dropped as of the Neo4j 4.0 release.
1615

@@ -120,4 +119,4 @@ Other Information
120119
.. _`Neo4j Cypher Refcard`: https://neo4j.com/docs/cypher-refcard/current/
121120
.. _`Example Project`: https://github.com/neo4j-examples/movies-python-bolt
122121
.. _`Driver Wiki`: https://github.com/neo4j/neo4j-python-driver/wiki
123-
.. _`Neo4j 4.0 Migration Guide`: https://neo4j.com/docs/migration-guide/4.0/
122+
.. _`Neo4j 4.0 Migration Guide`: https://neo4j.com/docs/migration-guide/4.0/

TESTING.md

Lines changed: 3 additions & 3 deletions
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 2.7, 3.4, 3.5 and 3.6.
4+
The versions of Python supported by this driver are CPython 3.6, 3.7, 3.8, and 3.9.
55

66

77
## Unit Tests & Stub Tests
@@ -40,7 +40,7 @@ a report can be viewed after the run with `coverage report --show-missing`.
4040

4141
## Testing with Testkit
4242

43-
Tests **require** the latest [Testkit 4.3](https://github.com/neo4j-drivers/testkit/tree/4.3), Python3 and Docker.
43+
Tests **require** the latest [Testkit 4.4](https://github.com/neo4j-drivers/testkit/tree/4.4), Python3 and Docker.
4444

4545
Testkit is needed to be cloned and configured to run against the Python Driver. Use the following steps to configure Testkit.
4646

@@ -69,4 +69,4 @@ To run test against against some Neo4j version:
6969
python3 main.py
7070
```
7171

72-
More details about how to use Teskit could be found on [its repository](https://github.com/neo4j-drivers/testkit/tree/4.3)
72+
More details about how to use Teskit could be found on [its repository](https://github.com/neo4j-drivers/testkit/tree/4.4)

docs/source/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ The Official Neo4j Driver for Python.
66

77
Neo4j versions supported:
88

9+
* Neo4j 4.4
910
* Neo4j 4.3
10-
* Neo4j 4.2
1111
* Neo4j 3.5
1212

1313
Python versions supported:
@@ -16,7 +16,6 @@ Python versions supported:
1616
* Python 3.8
1717
* Python 3.7
1818
* Python 3.6
19-
* Python 3.5
2019

2120
.. note::
2221

neo4j/conf.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -232,30 +232,14 @@ def get_ssl_context(self):
232232
# TLS 1.1 - Released in 2006, published as RFC 4346. (Disabled)
233233
# TLS 1.2 - Released in 2008, published as RFC 5246.
234234

235-
try:
236-
# python 3.6+
237-
# https://docs.python.org/3.6/library/ssl.html#ssl.PROTOCOL_TLS_CLIENT
238-
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
239-
240-
# For recommended security options see
241-
# https://docs.python.org/3.6/library/ssl.html#protocol-versions
242-
ssl_context.options |= ssl.OP_NO_TLSv1 # Python 3.2
243-
ssl_context.options |= ssl.OP_NO_TLSv1_1 # Python 3.4
244-
245-
except AttributeError:
246-
# python 3.5
247-
# https://docs.python.org/3.5/library/ssl.html#ssl.PROTOCOL_TLS
248-
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS)
249-
250-
# For recommended security options see
251-
# https://docs.python.org/3.5/library/ssl.html#protocol-versions
252-
ssl_context.options |= ssl.OP_NO_SSLv2 # Python 3.2
253-
ssl_context.options |= ssl.OP_NO_SSLv3 # Python 3.2
254-
ssl_context.options |= ssl.OP_NO_TLSv1 # Python 3.2
255-
ssl_context.options |= ssl.OP_NO_TLSv1_1 # Python 3.4
256-
257-
ssl_context.verify_mode = ssl.CERT_REQUIRED # https://docs.python.org/3.5/library/ssl.html#ssl.SSLContext.verify_mode
258-
ssl_context.check_hostname = True # https://docs.python.org/3.5/library/ssl.html#ssl.SSLContext.check_hostname
235+
# https://docs.python.org/3.6/library/ssl.html#ssl.PROTOCOL_TLS_CLIENT
236+
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
237+
238+
# For recommended security options see
239+
# https://docs.python.org/3.6/library/ssl.html#protocol-versions
240+
ssl_context.options |= ssl.OP_NO_TLSv1 # Python 3.2
241+
ssl_context.options |= ssl.OP_NO_TLSv1_1 # Python 3.4
242+
259243

260244
if self.trust == TRUST_ALL_CERTIFICATES:
261245
ssl_context.check_hostname = False

neo4j/io/__init__.py

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,15 @@ def protocol_handlers(cls, protocol_version=None):
211211

212212
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
213213
from neo4j.io._bolt3 import Bolt3
214-
from neo4j.io._bolt4 import Bolt4x0, Bolt4x1, Bolt4x2, Bolt4x3
214+
from neo4j.io._bolt4 import Bolt4x0, Bolt4x1, Bolt4x2, Bolt4x3, Bolt4x4
215215

216216
handlers = {
217217
Bolt3.PROTOCOL_VERSION: Bolt3,
218218
Bolt4x0.PROTOCOL_VERSION: Bolt4x0,
219219
Bolt4x1.PROTOCOL_VERSION: Bolt4x1,
220220
Bolt4x2.PROTOCOL_VERSION: Bolt4x2,
221221
Bolt4x3.PROTOCOL_VERSION: Bolt4x3,
222+
Bolt4x4.PROTOCOL_VERSION: Bolt4x4,
222223
}
223224

224225
if protocol_version is None:
@@ -238,25 +239,28 @@ def version_list(cls, versions, limit=4):
238239
preference. The number of protocol versions (or ranges)
239240
returned is limited to four.
240241
"""
241-
ranges_supported = versions[0] >= Version(4, 3)
242-
without_changes = {Version(4, 2)}
243-
if versions and ranges_supported:
244-
start, end = 0, 0
245-
first_major = versions[start][0]
246-
minors = []
247-
for version in versions:
248-
if version[0] == first_major:
249-
minors.append(version[1])
250-
else:
251-
break
252-
new_versions = [
253-
Version(first_major, minors),
254-
*(v for v in versions[1:] if v not in without_changes)
255-
]
256-
else:
257-
new_versions = [v for v in versions if v not in without_changes]
258-
new_versions = [*new_versions[:(limit - 1)], versions[-1]]
259-
return new_versions
242+
first_with_range_support = Version(4, 3)
243+
without_changes = {
244+
# to: from
245+
Version(4, 2): Version(4, 1),
246+
}
247+
result = []
248+
for version in versions:
249+
if (version in without_changes
250+
and without_changes[version] in versions):
251+
# equivalent lower protocol can and will be negotiated
252+
continue
253+
if (result
254+
and version >= first_with_range_support
255+
and result[-1][0] == version[0]
256+
and result[-1][1][1] == version[1] + 1):
257+
# can use range to encompass this version
258+
result[-1][1][1] = version[1]
259+
continue
260+
result.append(Version(version[0], [version[1], version[1]]))
261+
if len(result) == 4:
262+
break
263+
return result
260264

261265
@classmethod
262266
def get_handshake(cls):
@@ -310,33 +314,38 @@ def open(cls, address, *, auth=None, timeout=None, routing_context=None, **pool_
310314
keep_alive=pool_config.keep_alive,
311315
)
312316

317+
# Carry out Bolt subclass imports locally to avoid circular dependency
318+
# issues.
313319
if pool_config.protocol_version == (3, 0):
314-
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
315320
from neo4j.io._bolt3 import Bolt3
316-
connection = Bolt3(address, s, pool_config.max_connection_lifetime, auth=auth, user_agent=pool_config.user_agent, routing_context=routing_context)
321+
bolt_cls = Bolt3
317322
elif pool_config.protocol_version == (4, 0):
318-
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
319323
from neo4j.io._bolt4 import Bolt4x0
320-
connection = Bolt4x0(address, s, pool_config.max_connection_lifetime, auth=auth, user_agent=pool_config.user_agent, routing_context=routing_context)
324+
bolt_cls = Bolt4x0
321325
elif pool_config.protocol_version == (4, 1):
322-
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
323326
from neo4j.io._bolt4 import Bolt4x1
324-
connection = Bolt4x1(address, s, pool_config.max_connection_lifetime, auth=auth, user_agent=pool_config.user_agent, routing_context=routing_context)
327+
bolt_cls = Bolt4x1
325328
elif pool_config.protocol_version == (4, 2):
326-
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
327329
from neo4j.io._bolt4 import Bolt4x2
328-
connection = Bolt4x2(address, s, pool_config.max_connection_lifetime, auth=auth, user_agent=pool_config.user_agent, routing_context=routing_context)
330+
bolt_cls = Bolt4x2
329331
elif pool_config.protocol_version == (4, 3):
330-
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
331332
from neo4j.io._bolt4 import Bolt4x3
332-
connection = Bolt4x3(address, s, pool_config.max_connection_lifetime, auth=auth, user_agent=pool_config.user_agent, routing_context=routing_context)
333+
bolt_cls = Bolt4x3
334+
elif pool_config.protocol_version == (4, 4):
335+
from neo4j.io._bolt4 import Bolt4x4
336+
bolt_cls = Bolt4x4
333337
else:
334338
log.debug("[#%04X] S: <CLOSE>", s.getpeername()[1])
335339
_close_socket(s)
336340

337341
supported_versions = Bolt.protocol_handlers().keys()
338342
raise BoltHandshakeError("The Neo4J server does not support communication with this driver. This driver have support for Bolt Protocols {}".format(supported_versions), address=address, request_data=handshake, response_data=data)
339343

344+
connection = bolt_cls(
345+
address, s, pool_config.max_connection_lifetime, auth=auth,
346+
user_agent=pool_config.user_agent, routing_context=routing_context
347+
)
348+
340349
try:
341350
connection.hello()
342351
except Exception:

neo4j/io/_bolt3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
class Bolt3(Bolt):
5656
""" Protocol handler for Bolt 3.
5757
58-
This is supported by Neo4j versions 3.5, 4.0, 4.1 and 4.2.
58+
This is supported by Neo4j versions 3.5, 4.0, 4.1, 4.2, 4.3, and 4.4.
5959
"""
6060

6161
PROTOCOL_VERSION = Version(3, 0)

neo4j/io/_bolt4.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def defunct(self):
316316
class Bolt4x1(Bolt4x0):
317317
""" Protocol handler for Bolt 4.1.
318318
319-
This is supported by Neo4j versions 4.1 and 4.2.
319+
This is supported by Neo4j versions 4.1 - 4.4.
320320
"""
321321

322322
PROTOCOL_VERSION = Version(4, 1)
@@ -338,7 +338,7 @@ def get_base_headers(self):
338338
class Bolt4x2(Bolt4x1):
339339
""" Protocol handler for Bolt 4.2.
340340
341-
This is supported by Neo4j version 4.2.
341+
This is supported by Neo4j version 4.2 - 4.4.
342342
"""
343343

344344
PROTOCOL_VERSION = Version(4, 2)
@@ -347,7 +347,7 @@ class Bolt4x2(Bolt4x1):
347347
class Bolt4x3(Bolt4x2):
348348
""" Protocol handler for Bolt 4.3.
349349
350-
This is supported by Neo4j version 4.3.
350+
This is supported by Neo4j version 4.3 - 4.4.
351351
"""
352352

353353
PROTOCOL_VERSION = Version(4, 3)
@@ -376,3 +376,12 @@ def fail(md):
376376
self.send_all()
377377
self.fetch_all()
378378
return [metadata.get("rt")]
379+
380+
381+
class Bolt4x4(Bolt4x3):
382+
""" Protocol handler for Bolt 4.4.
383+
384+
This is supported by Neo4j version 4.4.
385+
"""
386+
387+
PROTOCOL_VERSION = Version(4, 4)

neo4j/meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# Can be automatically overridden in builds
2323
package = "neo4j"
24-
version = "4.3.dev0"
24+
version = "4.4.dev0"
2525

2626

2727
def get_user_agent():

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"Operating System :: OS Independent",
3434
"Topic :: Database",
3535
"Topic :: Software Development",
36-
"Programming Language :: Python :: 3.5",
3736
"Programming Language :: Python :: 3.6",
3837
"Programming Language :: Python :: 3.7",
3938
"Programming Language :: Python :: 3.8",

testkit/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ ENV PYENV_ROOT /.pyenv
4040
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
4141

4242
# Set minimum supported Python version
43-
RUN pyenv install 3.5.9
43+
RUN pyenv install 3.6.13
4444
RUN pyenv rehash
45-
RUN pyenv global 3.5.9
45+
RUN pyenv global 3.6.13
4646

4747
# Install Latest pip for each environment
4848
# https://pip.pypa.io/en/stable/news/

tests/unit/io/test_class_bolt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
def test_class_method_protocol_handlers():
2929
# python -m pytest tests/unit/io/test_class_bolt.py -s -v -k test_class_method_protocol_handlers
3030
protocol_handlers = Bolt.protocol_handlers()
31-
assert len(protocol_handlers) == 5
31+
assert len(protocol_handlers) == 6
3232

3333

3434
@pytest.mark.parametrize(
@@ -53,7 +53,7 @@ def test_class_method_protocol_handlers_with_invalid_protocol_version():
5353
def test_class_method_get_handshake():
5454
# python -m pytest tests/unit/io/test_class_bolt.py -s -v -k test_class_method_get_handshake
5555
handshake = Bolt.get_handshake()
56-
assert handshake == b"\x00\x03\x03\x04\x00\x00\x01\x04\x00\x00\x00\x04\x00\x00\x00\x03"
56+
assert handshake == b"\x00\x01\x04\x04\x00\x00\x01\x04\x00\x00\x00\x04\x00\x00\x00\x03"
5757

5858

5959
def test_magic_preamble():

tox-unit.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py35
3+
py36
44

55
[testenv]
66
deps =

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[tox]
22
envlist =
3-
py35
43
py36
54
py37
65
py38

0 commit comments

Comments
 (0)