Skip to content

Commit 1cda454

Browse files
authored
Add Python 3.13 support (#1106)
1 parent 1d07bb5 commit 1cda454

File tree

13 files changed

+80
-20
lines changed

13 files changed

+80
-20
lines changed

CHANGELOG.md

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

55
## NEXT RELEASE
6+
- Python 3.13 support added.
67
- Deprecated setting attributes on `Neo4jError` like `message` and `code`.
78
- Deprecated undocumented method `Neo4jError.hydrate`.
89
It's internal and should not be used by client code.

README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ breaking API changes.
1616

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

19-
+ Python 3.12 supported.
20-
+ Python 3.11 supported.
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).
2122
+ Python 3.10 supported.
2223
+ Python 3.9 supported.
2324
+ Python 3.8 supported.

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Neo4j versions supported:
1212

1313
Python versions supported:
1414

15+
* Python 3.13 (added in driver version 5.26.0)
1516
* Python 3.12 (added in driver version 5.14.0)
1617
* Python 3.11 (added in driver version 5.3.0)
1718
* Python 3.10

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ classifiers = [
3737
"Programming Language :: Python :: 3.10",
3838
"Programming Language :: Python :: 3.11",
3939
"Programming Language :: Python :: 3.12",
40+
"Programming Language :: Python :: 3.13",
4041
"Topic :: Database",
4142
"Topic :: Software Development",
4243
"Typing :: Typed",

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ tox>=4.0.0
3030
sphinx
3131

3232
# needed for BenchKit
33-
sanic>=23.12.1; python_version >= '3.8.0'
33+
sanic>=23.12.1 ; python_version >= '3.8.0'

src/neo4j/_async/work/session.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@
2626
from ..._async_compat import async_sleep
2727
from ..._async_compat.util import AsyncUtil
2828
from ..._conf import SessionConfig
29-
from ..._meta import deprecated
29+
30+
31+
if t.TYPE_CHECKING:
32+
from typing_extensions import deprecated
33+
else:
34+
from ..._meta import deprecated
35+
3036
from ..._util import ContextBool
3137
from ..._work import Query
3238
from ...api import (

src/neo4j/_data.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@
3131

3232
from ._codec.hydration import BrokenHydrationObject
3333
from ._conf import iter_items
34-
from ._meta import deprecated
34+
35+
36+
if t.TYPE_CHECKING:
37+
from typing_extensions import deprecated
38+
else:
39+
from ._meta import deprecated
40+
3541
from ._spatial import Point
3642
from .exceptions import BrokenRecordError
3743
from .graph import (

src/neo4j/_meta.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,23 @@ def deprecated(message: str) -> t.Callable[[_FuncT], _FuncT]:
111111
@deprecated("'foo' has been deprecated in favour of 'bar'")
112112
def foo(x):
113113
pass
114-
"""
115-
return _make_warning_decorator(message, deprecation_warn)
116114
115+
@property
116+
@deprecated("'bar' will be internal without a replacement")
117+
def bar(self):
118+
return "bar"
117119
118-
def deprecated_property(message: str):
119-
def decorator(f):
120-
return property(deprecated(message)(f))
120+
@property
121+
def baz(self):
122+
return self._baz
121123
122-
return t.cast(property, decorator)
124+
@baz.setter
125+
@deprecated("'baz' will be read-only in the future")
126+
def baz(self, value):
127+
self._baz = value
128+
129+
"""
130+
return _make_warning_decorator(message, deprecation_warn)
123131

124132

125133
# TODO: 6.0 - remove this class, replace usage with PreviewWarning

src/neo4j/_sync/work/session.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@
2626
from ..._async_compat import sleep
2727
from ..._async_compat.util import Util
2828
from ..._conf import SessionConfig
29-
from ..._meta import deprecated
29+
30+
31+
if t.TYPE_CHECKING:
32+
from typing_extensions import deprecated
33+
else:
34+
from ..._meta import deprecated
35+
3036
from ..._util import ContextBool
3137
from ..._work import Query
3238
from ...api import (

src/neo4j/api.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
urlparse,
2626
)
2727

28-
from ._meta import deprecated
28+
29+
if t.TYPE_CHECKING:
30+
from typing_extensions import deprecated
31+
else:
32+
from ._meta import deprecated
33+
2934
from .exceptions import ConfigurationError
3035

3136

src/neo4j/spatial/__init__.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
"""Spatial data types for interchange with the DBMS."""
1818

19+
from __future__ import annotations
20+
21+
1922
__all__ = [
2023
"CartesianPoint",
2124
"Point",
@@ -25,10 +28,17 @@
2528
"point_type",
2629
]
2730

31+
import typing as t
2832
from functools import wraps
2933

3034
from .._codec.hydration.v1 import spatial as _hydration
31-
from .._meta import deprecated
35+
36+
37+
if t.TYPE_CHECKING:
38+
from typing_extensions import deprecated
39+
else:
40+
from .._meta import deprecated
41+
3242
from .._spatial import (
3343
CartesianPoint,
3444
Point,

testkit/Dockerfile

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM ubuntu:20.04
22

3-
ENV DEBIAN_FRONTEND noninteractive
3+
ENV DEBIAN_FRONTEND=noninteractive
44
RUN apt-get update && \
55
apt-get install -y locales && \
66
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
77
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
88
&& rm -rf /var/lib/apt/lists/*
9-
ENV LANG en_US.UTF-8
9+
ENV LANG=en_US.UTF-8
1010

1111
# Using apt-get update alone in a RUN statement causes caching issues and subsequent apt-get install instructions fail.
1212
RUN apt-get --quiet update && apt-get --quiet install -y \
@@ -38,11 +38,11 @@ RUN update-ca-certificates
3838

3939
# Install pyenv
4040
RUN git clone https://github.com/pyenv/pyenv.git .pyenv
41-
ENV PYENV_ROOT /.pyenv
42-
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
41+
ENV PYENV_ROOT=/.pyenv
42+
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"
4343

4444
# Setup python version
45-
ENV PYTHON_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7
45+
ENV PYTHON_VERSIONS="3.13 3.12 3.11 3.10 3.9 3.8 3.7"
4646

4747
RUN for version in $PYTHON_VERSIONS; do \
4848
pyenv install $version; \
@@ -57,3 +57,18 @@ RUN for version in $PYTHON_VERSIONS; do \
5757
python$version -m pip install -U pip && \
5858
python$version -m pip install -U coverage tox; \
5959
done
60+
61+
# Installing pyarrow lib until pre-built wheel for Python 3.13 exists
62+
# https://github.com/apache/arrow/issues/43519
63+
RUN apt update && \
64+
apt install -y -V lsb-release cmake gcc && \
65+
distro_name=$(lsb_release --id --short | tr 'A-Z' 'a-z') && \
66+
code_name=$(lsb_release --codename --short) && \
67+
wget https://apache.jfrog.io/artifactory/arrow/${distro_name}/apache-arrow-apt-source-latest-${code_name}.deb && \
68+
apt install -y -V ./apache-arrow-apt-source-latest-${code_name}.deb && \
69+
apt update && \
70+
apt install -y -V libarrow-dev libarrow-dataset-dev libarrow-flight-dev libparquet-dev && \
71+
apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
72+
ENV PYARROW_WITH_CUDA=off
73+
ENV PYARROW_WITH_GANDIVA=off
74+
ENV PYARROW_PARALLEL=8

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{37,38,39,310,311,312}-{unit,integration,performance}
2+
envlist = py{37,38,39,310,311,312,313}-{unit,integration,performance}
33

44
[testenv]
55
passenv = TEST_NEO4J_*

0 commit comments

Comments
 (0)