Skip to content

Commit b0bc09b

Browse files
committed
Dependencies: Improve Python compatibility
1 parent cd24f38 commit b0bc09b

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling >= 1.26"]
2+
requires = ["hatchling"]
33
build-backend = "hatchling.build"
44

55
[tool.hatch.build.targets.wheel]
@@ -13,7 +13,7 @@ name = "crate-python"
1313
dynamic = ["version"]
1414
description = "CrateDB Python Client"
1515
authors = [{ name = "Crate.io", email = "[email protected]" }]
16-
requires-python = ">=3.10"
16+
requires-python = ">=3.6"
1717
readme = "README.rst"
1818
license = "Apache-2.0"
1919
classifiers = [
@@ -36,21 +36,21 @@ classifiers = [
3636
"Topic :: System :: Networking",
3737
]
3838
dependencies = [
39-
"orjson>=3.11.3",
39+
"orjson",
4040
"urllib3",
4141
"verlib2>=0.3.1",
4242
]
4343

4444
[dependency-groups]
4545
dev = [
46-
"certifi>=2025.10.5",
46+
"backports.zoneinfo<1; python_version<'3.9'",
47+
"certifi",
4748
"coverage<8",
4849
"mypy<1.19",
4950
"poethepoet<1",
5051
"pytest<9",
51-
"pytz>=2025.2",
52+
"pytz",
5253
"ruff<0.15",
53-
"setuptools>=80.9.0",
5454
"stopit<1.2",
5555
]
5656

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
zc.buildout==5.1.1
2-
zope.interface==8.1.1
2+
zope.interface>=8
33
zope.testrunner>=5,<8

src/crate/client/cursor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ def duration(self):
221221
def _convert_rows(self):
222222
"""
223223
Iterate rows, apply type converters, and generate converted rows.
224+
225+
The converter is only supported on Python >= 3.10.
224226
"""
225227
if not ("col_types" in self._result and self._result["col_types"]):
226228
raise ValueError(
@@ -238,7 +240,7 @@ def _convert_rows(self):
238240
for row in self._result["rows"]:
239241
yield [
240242
convert(value)
241-
for convert, value in zip(converters, row, strict=False)
243+
for convert, value in zip(converters, row, strict=False) # type: ignore[call-overload]
242244
]
243245

244246
@property

tests/client/test_cursor.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# software solely pursuant to the terms of the relevant commercial agreement.
2121

2222
import datetime
23+
import sys
2324
from ipaddress import IPv4Address
2425
from unittest import mock
2526

@@ -58,6 +59,9 @@ def test_cursor_fetch(mocked_connection):
5859
]
5960

6061

62+
@pytest.mark.skipif(
63+
sys.version_info < (3, 10), reason="Test needs Python >= 3.10"
64+
)
6165
def test_cursor_description(mocked_connection):
6266
cursor = mocked_connection.cursor()
6367
response = {
@@ -249,6 +253,9 @@ def test_execute_with_bulk_args(mocked_connection):
249253
mocked_connection.client.sql.assert_called_once_with(statement, None, [[1]])
250254

251255

256+
@pytest.mark.skipif(
257+
sys.version_info < (3, 10), reason="Converter needs Python >= 3.10"
258+
)
252259
def test_execute_custom_converter(mocked_connection):
253260
"""
254261
Verify that a custom converter is correctly applied when passed to a cursor.
@@ -299,6 +306,9 @@ def test_execute_custom_converter(mocked_connection):
299306
]
300307

301308

309+
@pytest.mark.skipif(
310+
sys.version_info < (3, 10), reason="Converter needs Python >= 3.10"
311+
)
302312
def test_execute_with_converter_and_invalid_data_type(mocked_connection):
303313
converter = DefaultTypeConverter()
304314

@@ -323,6 +333,9 @@ def test_execute_with_converter_and_invalid_data_type(mocked_connection):
323333
assert e.exception.args == "999 is not a valid DataType"
324334

325335

336+
@pytest.mark.skipif(
337+
sys.version_info < (3, 10), reason="Converter needs Python >= 3.10"
338+
)
326339
def test_execute_array_with_converter(mocked_connection):
327340
converter = DefaultTypeConverter()
328341
cursor = mocked_connection.cursor(converter=converter)
@@ -345,6 +358,9 @@ def test_execute_array_with_converter(mocked_connection):
345358
]
346359

347360

361+
@pytest.mark.skipif(
362+
sys.version_info < (3, 10), reason="Converter needs Python >= 3.10"
363+
)
348364
def test_execute_array_with_converter_invalid(mocked_connection):
349365
converter = DefaultTypeConverter()
350366
cursor = mocked_connection.cursor(converter=converter)
@@ -368,6 +384,9 @@ def test_execute_array_with_converter_invalid(mocked_connection):
368384
)
369385

370386

387+
@pytest.mark.skipif(
388+
sys.version_info < (3, 10), reason="Converter needs Python >= 3.10"
389+
)
371390
def test_execute_nested_array_with_converter(mocked_connection):
372391
converter = DefaultTypeConverter()
373392
cursor = mocked_connection.cursor(converter=converter)
@@ -405,6 +424,9 @@ def test_execute_nested_array_with_converter(mocked_connection):
405424
]
406425

407426

427+
@pytest.mark.skipif(
428+
sys.version_info < (3, 10), reason="Converter needs Python >= 3.10"
429+
)
408430
def test_executemany_with_converter(mocked_connection):
409431
converter = DefaultTypeConverter()
410432
cursor = mocked_connection.cursor(converter=converter)
@@ -426,6 +448,9 @@ def test_executemany_with_converter(mocked_connection):
426448
assert result == []
427449

428450

451+
@pytest.mark.skipif(
452+
sys.version_info < (3, 10), reason="Converter needs Python >= 3.10"
453+
)
429454
def test_execute_with_timezone(mocked_connection):
430455
# Create a `Cursor` object with `time_zone`.
431456
tz_mst = datetime.timezone(datetime.timedelta(hours=7), name="MST")

0 commit comments

Comments
 (0)