Skip to content

Commit d168d97

Browse files
authored
Bump dependencies & enable Python 3.7 dev env (#1130)
1 parent b957a74 commit d168d97

File tree

13 files changed

+92
-89
lines changed

13 files changed

+92
-89
lines changed

.pre-commit-config.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ repos:
1919
- batch
2020
- id: trailing-whitespace
2121
args: [ --markdown-linebreak-ext=md ]
22-
- repo: https://github.com/pycqa/isort
23-
rev: 5.12.0
22+
- repo: local
2423
hooks:
2524
- id: isort
25+
name: isort
26+
entry: isort
27+
types_or: [ python, pyi ]
28+
language: system
2629
- repo: https://github.com/sphinx-contrib/sphinx-lint
2730
rev: e83a1a42a73284d301c05baaffc176042ffbcf82
2831
hooks:
@@ -45,7 +48,7 @@ repos:
4548
name: mypy static type check
4649
entry: mypy
4750
args: [ --show-error-codes, src, tests, testkitbackend, benchkit ]
48-
'types_or': [ python, pyi ]
51+
types_or: [ python, pyi ]
4952
language: system
5053
pass_filenames: false
5154
require_serial: true

benchkit/app.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from __future__ import annotations
1818

19+
import sys
1920
import typing as t
2021
from contextlib import contextmanager
2122
from multiprocessing import Semaphore
@@ -43,7 +44,10 @@
4344
from .workloads import Workload
4445

4546

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

4852

4953
def create_app() -> T_App:

benchkit/workloads.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def parse(cls, query: t.Any) -> te.Self:
543543
@dataclass
544544
class _WorkloadConfig:
545545
database: str | None
546-
routing: t.Literal["r", "w"]
546+
routing: te.Literal["r", "w"]
547547

548548
@classmethod
549549
def parse(cls, data: t.Any) -> te.Self:
@@ -553,7 +553,7 @@ def parse(cls, data: t.Any) -> te.Self:
553553
if not isinstance(database, str):
554554
raise TypeError("Workload database must be a string")
555555

556-
routing: t.Literal["r", "w"] = "w"
556+
routing: te.Literal["r", "w"] = "w"
557557
if "routing" in data:
558558
raw_routing = data["routing"]
559559
if not isinstance(routing, str):

requirements-dev.txt

+18-19
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,31 @@
22
-e .[pandas,numpy,pyarrow]
33

44
# needed for packaging
5-
build
5+
build>=1.1.1 # TODO: 6.0 - bump when support for Python 3.7 is dropped
66

77
# auto-generate sync driver from async code
8-
unasync>=0.5.0
8+
unasync==0.5.0
99
# pre-commit hooks and tools
10-
pre-commit>=2.15.0
11-
isort>=5.10.0
12-
mypy>=0.971
13-
typing-extensions>=4.3.0
14-
types-pytz>=2022.1.2
15-
ruff>=0.6.4
10+
pre-commit>=2.21.0 # TODO: 6.0 - bump when support for Python 3.7 is dropped
11+
isort>=5.11.5 # TODO: 6.0 - bump when support for Python 3.7 is dropped
12+
mypy>=1.4.1 # TODO: 6.0 - bump when support for Python 3.7 is dropped
13+
typing-extensions>=4.7.1
14+
types-pytz>=2023.3.1.1 # TODO: 6.0 - bump when support for Python 3.7 is dropped
15+
ruff>=0.8.2
1616

1717
# needed for running tests
18-
coverage[toml]>=5.5
18+
coverage[toml]>=7.2.7 # TODO: 6.0 - bump when support for Python 3.7 is dropped
1919
freezegun>=1.5.1
20-
mock>=4.0.3
21-
pytest>=6.2.5
22-
pytest-asyncio>=0.16.0
23-
pytest-benchmark>=3.4.1
24-
pytest-cov>=3.0.0
25-
pytest-mock>=3.6.1
26-
tox>=4.0.0
27-
teamcity-messages>=1.32
20+
mock>=5.1.0
21+
pytest>=7.4.4 # TODO: 6.0 - bump when support for Python 3.7 is dropped
22+
pytest-asyncio~=0.21.2 # TODO: 6.0 - bump when support for Python 3.7 is dropped
23+
pytest-benchmark>=4.0.0
24+
pytest-cov>=4.1.0 # TODO: 6.0 - bump when support for Python 3.7 is dropped
25+
pytest-mock>=3.11.1 # TODO: 6.0 - bump when support for Python 3.7 is dropped
26+
tox>=4.8.0 # TODO: 6.0 - bump when support for Python 3.7 is dropped
2827

2928
# needed for building docs
30-
sphinx
29+
Sphinx>=5.3.0 # TODO: 6.0 - bump when support for Python 3.7 is dropped
3130

3231
# needed for BenchKit
33-
sanic>=23.12.1 ; python_version >= '3.8.0'
32+
sanic>=23.3.0 # TODO: 6.0 - bump when support for Python 3.7 is dropped

src/neo4j/_async/work/result.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class AsyncResult(AsyncNonConcurrentMethodChecker):
105105
"""
106106

107107
_creation_stack: list[inspect.FrameInfo] | None
108-
_creation_frame_cache: None | t.Literal[False] | inspect.FrameInfo
108+
_creation_frame_cache: None | te.Literal[False] | inspect.FrameInfo
109109

110110
def __init__(
111111
self,
@@ -356,7 +356,7 @@ def _handle_warnings(self) -> None:
356356
)
357357

358358
@property
359-
def _creation_frame(self) -> t.Literal[False] | inspect.FrameInfo:
359+
def _creation_frame(self) -> te.Literal[False] | inspect.FrameInfo:
360360
if self._creation_frame_cache is not None:
361361
return self._creation_frame_cache
362362

src/neo4j/_spatial/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def y(self) -> float: ...
5858
def z(self) -> float: ...
5959

6060
def __new__(cls, iterable: t.Iterable[float]) -> Point:
61-
return tuple.__new__(cls, map(float, iterable))
61+
# TODO: 6.0 - remove type ignore when support for Python 3.7 is dropped
62+
return tuple.__new__(cls, map(float, iterable)) # type: ignore[type-var]
6263

6364
def __repr__(self) -> str:
6465
return f"POINT({' '.join(map(str, self))})"

src/neo4j/_sync/work/result.py

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/neo4j/api.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ def protocol_version(self) -> tuple[int, int]:
385385
This is returned as a 2-tuple:class:`tuple` (subclass) of
386386
``(major, minor)`` integers.
387387
"""
388-
return self._protocol_version
388+
# TODO: 6.0 - remove cast when support for Python 3.7 is dropped
389+
return t.cast(t.Tuple[int, int], self._protocol_version)
389390

390391
@property
391392
def agent(self) -> str:

src/neo4j/time/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ def __new__(
470470
)
471471
if not MIN_INT64 <= avg_total_seconds <= MAX_INT64:
472472
raise ValueError(f"Duration value out of range: {tuple_!r}")
473-
return tuple.__new__(cls, tuple_)
473+
# TODO: 6.0 - remove type ignore when support for Python 3.7 is dropped
474+
return tuple.__new__(cls, tuple_) # type: ignore[type-var]
474475

475476
def __bool__(self) -> bool:
476477
"""Falsy if all primary instance attributes are."""

testkit/Dockerfile

-15
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,3 @@ 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

tests/unit/async_/test_driver.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -780,11 +780,10 @@ async def test_warn_notification_severity_driver_config(
780780
if min_sev_session is ...:
781781
session = driver.session()
782782
else:
783-
session = driver.session(
784-
# Works at runtime (will be ignored), but should be rejected by
785-
# type checkers.
786-
# type: ignore[call-arg]
787-
warn_notification_severity=min_sev_session
783+
# Works at runtime (will be ignored), but should be rejected by
784+
# type checkers.
785+
session = driver.session( # type: ignore[call-arg]
786+
warn_notification_severity=min_sev_session,
788787
)
789788
async with session:
790789
session_cls_mock.assert_called_once()

tests/unit/common/test_record.py

+43-32
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from __future__ import annotations
1818

1919
import traceback
20+
import typing as t
2021

2122
import pytest
2223
import pytz
@@ -166,39 +167,49 @@ def test_record_data_keys(keys, expected) -> None:
166167
(
167168
*(
168169
(value, value)
169-
for value in (
170-
None,
171-
True,
172-
False,
173-
0,
174-
1,
175-
-1,
176-
2147483647,
177-
-2147483648,
178-
3.141592653589,
179-
"",
180-
"Hello, world!",
181-
"👋, 🌍!",
182-
[],
183-
[1, 2.0, "3", True, None],
184-
{"foo": ["bar", 1]},
185-
b"",
186-
b"foobar",
187-
Date(2021, 1, 1),
188-
Time(12, 34, 56, 123456789),
189-
Time(1, 2, 3, 4, pytz.FixedOffset(60)),
190-
DateTime(2021, 1, 1, 12, 34, 56, 123456789),
191-
DateTime(
192-
2018, 10, 12, 11, 37, 41, 474716862, pytz.FixedOffset(60)
193-
),
194-
pytz.timezone("Europe/Stockholm").localize(
195-
DateTime(2018, 10, 12, 11, 37, 41, 474716862)
170+
for value in t.cast(
171+
t.Tuple[t.Any],
172+
(
173+
None,
174+
True,
175+
False,
176+
0,
177+
1,
178+
-1,
179+
2147483647,
180+
-2147483648,
181+
3.141592653589,
182+
"",
183+
"Hello, world!",
184+
"👋, 🌍!",
185+
[],
186+
[1, 2.0, "3", True, None],
187+
{"foo": ["bar", 1]},
188+
b"",
189+
b"foobar",
190+
Date(2021, 1, 1),
191+
Time(12, 34, 56, 123456789),
192+
Time(1, 2, 3, 4, pytz.FixedOffset(60)),
193+
DateTime(2021, 1, 1, 12, 34, 56, 123456789),
194+
DateTime(
195+
2018,
196+
10,
197+
12,
198+
11,
199+
37,
200+
41,
201+
474716862,
202+
pytz.FixedOffset(60),
203+
),
204+
pytz.timezone("Europe/Stockholm").localize(
205+
DateTime(2018, 10, 12, 11, 37, 41, 474716862)
206+
),
207+
Duration(1, 2, 3, 4, 5, 6, 7),
208+
CartesianPoint((1, 2.0)),
209+
CartesianPoint((1, 2.0, 3)),
210+
WGS84Point((1, 2.0)),
211+
WGS84Point((1, 2.0, 3)),
196212
),
197-
Duration(1, 2, 3, 4, 5, 6, 7),
198-
CartesianPoint((1, 2.0)),
199-
CartesianPoint((1, 2.0, 3)),
200-
WGS84Point((1, 2.0)),
201-
WGS84Point((1, 2.0, 3)),
202213
)
203214
),
204215
*(

tests/unit/sync/test_driver.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,10 @@ def test_warn_notification_severity_driver_config(
779779
if min_sev_session is ...:
780780
session = driver.session()
781781
else:
782-
session = driver.session(
783-
# Works at runtime (will be ignored), but should be rejected by
784-
# type checkers.
785-
# type: ignore[call-arg]
786-
warn_notification_severity=min_sev_session
782+
# Works at runtime (will be ignored), but should be rejected by
783+
# type checkers.
784+
session = driver.session( # type: ignore[call-arg]
785+
warn_notification_severity=min_sev_session,
787786
)
788787
with session:
789788
session_cls_mock.assert_called_once()

0 commit comments

Comments
 (0)