Skip to content

[4.4] Add Support for Python 3.10 #832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Neo4j Driver Change Log

## Version 4.4.9

- Python 3.10 support added


## Version 4.4

- Python 3.5 support has been dropped.
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This repository contains the official Neo4j driver for Python.
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.
These drivers will also be compatible with the previous Neo4j release, although new server features will not be available.

+ Python 3.10 supported.
+ Python 3.9 supported.
+ Python 3.8 supported.
+ Python 3.7 supported.
Expand Down
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Neo4j Driver Testing

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


## Unit Tests & Stub Tests
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Neo4j versions supported:

Python versions supported:

* Python 3.10 (added in driver version 4.4.9)
* Python 3.9
* Python 3.8
* Python 3.7
Expand Down
13 changes: 9 additions & 4 deletions neo4j/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

from abc import ABCMeta
from collections.abc import Mapping
import sys
import warnings
from warnings import warn

from neo4j.meta import (
deprecation_warn,
Expand Down Expand Up @@ -83,7 +83,9 @@ def __new__(mcs, name, bases, attributes):
for k, v in attributes.items():
if isinstance(v, DeprecatedAlias):
deprecated_aliases[k] = v.new
elif not k.startswith("_") and not callable(v):
elif not (k.startswith("_")
or callable(v)
or isinstance(v, (staticmethod, classmethod))):
fields.append(k)
if isinstance(v, DeprecatedOption):
deprecated_options[k] = v.value
Expand Down Expand Up @@ -286,8 +288,11 @@ def get_ssl_context(self):

# For recommended security options see
# https://docs.python.org/3.6/library/ssl.html#protocol-versions
ssl_context.options |= ssl.OP_NO_TLSv1 # Python 3.2
ssl_context.options |= ssl.OP_NO_TLSv1_1 # Python 3.4
if sys.version_info >= (3, 7):
ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2 # Python 3.10
else:
ssl_context.options |= ssl.OP_NO_TLSv1 # Python 3.2
ssl_context.options |= ssl.OP_NO_TLSv1_1 # Python 3.4


if self.trust == TRUST_ALL_CERTIFICATES:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
entry_points = {
"console_scripts": [
Expand Down
2 changes: 1 addition & 1 deletion testkit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ENV PYENV_ROOT /.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH

# Setup python version
ENV PYTHON_VERSIONS 3.6 3.7 3.8 3.9
ENV PYTHON_VERSIONS 3.6 3.7 3.8 3.9 3.10

RUN for version in $PYTHON_VERSIONS; do \
pyenv install $version:latest; \
Expand Down
16 changes: 9 additions & 7 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@
from threading import RLock

import pytest
import urllib
import warnings

from neo4j import (
GraphDatabase,
)
from neo4j.exceptions import ServiceUnavailable
from neo4j import GraphDatabase
from neo4j._exceptions import BoltHandshakeError
from neo4j.exceptions import ServiceUnavailable
from neo4j.io import Bolt

# import logging
Expand Down Expand Up @@ -76,7 +74,9 @@ def __init__(self, name=None, image=None, auth=None,
n_cores=None, n_replicas=None,
bolt_port=None, http_port=None, debug_port=None,
debug_suspend=None, dir_spec=None, config=None):
from boltkit.legacy.controller import _install, create_controller
with warnings.catch_warnings():
warnings.simplefilter("ignore", ImportWarning)
from boltkit.legacy.controller import _install, create_controller
assert image.endswith("-enterprise")
release = image[:-11]
if release == "snapshot":
Expand Down Expand Up @@ -189,7 +189,9 @@ def service(request):
if existing_service:
NEO4J_SERVICE = existing_service
else:
NEO4J_SERVICE = Neo4jService(auth=NEO4J_AUTH, image=request.param, n_cores=NEO4J_CORES, n_replicas=NEO4J_REPLICAS)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
NEO4J_SERVICE = Neo4jService(auth=NEO4J_AUTH, image=request.param, n_cores=NEO4J_CORES, n_replicas=NEO4J_REPLICAS)
NEO4J_SERVICE.start(timeout=300)
yield NEO4J_SERVICE
if NEO4J_SERVICE is not None:
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ coverage
pytest
pytest-benchmark
pytest-cov
pytest-mock
pytest-mock~=3.6.1
teamcity-messages
pandas>=1.0.0
5 changes: 4 additions & 1 deletion tests/stub/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@

import subprocess
import os
import warnings

from platform import system
from threading import Thread
from time import sleep

from boltkit.server.stub import BoltStubService
with warnings.catch_warnings():
warnings.simplefilter("ignore", ImportWarning)
from boltkit.server.stub import BoltStubService
from pytest import fixture

import logging
Expand Down
Loading