Skip to content

Commit 951dcb3

Browse files
authored
Drop Python 3.9 support and refresh vulnerable deps (#429)
* Drop Python 3.9 support and refresh vulnerable deps * fix: single line import of Any
1 parent 391940d commit 951dcb3

23 files changed

Lines changed: 122 additions & 336 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
env:
1313
PYTHON_VERSION: "3.12"
14-
LEAST_PYTHON_VERSION: "3.9"
14+
LEAST_PYTHON_VERSION: "3.10"
1515
UV_FROZEN: "true"
1616
UV_NO_SYNC: "true"
1717

.github/workflows/unit.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
strategy:
3131
matrix:
3232
python-version:
33-
- "3.9"
3433
- "3.10"
3534
- "3.11"
3635
- "3.12.7" # to ensure the 'no ssl reuse' route is tested

CHANGES

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
main
22
====
3+
Supported Python versions are now 3.10 to 3.14:
4+
- removal of Python 3.9 [Breaking change w.r.t. 2.2]
35
`AstraDatabaseAdmin`: support for listing PCU Groups.
46
- Added `PCUGroupDescriptor`/`PCUGroupTypeDescriptor`/`PCUGroupTypeDetailsDescriptor` classes.
57
- Added `[async_]list_pcu_groups` method.
@@ -20,8 +22,8 @@ Bugfix: faulty normalization of empty/null indexing targets for `CollectionDefin
2022
maintenance: integration testing gets an embedding provider switcher logic
2123
maintenance: integration tests use the latest HCD (2.0.6) and a recent Data API build (1.0.46)
2224
maintenance: integration tests have configurable page size for find pagination
25+
maintenance: bump idna (3.10->3.18) and pygments (2.19.2->2.20.0) in uv.lock to clear Dependabot alerts.
2326
maintenance: base and vectorize integration tests fail fast unless all non-system keyspaces in the target database are free of collections, tables and UDTs (set `TOLERATE_POPULATED_DATABASE=yes` for intentional narrow local runs)
24-
maintenance: bump idna (3.10->3.18) and pygments (2.19.2->2.20.0) in uv.lock to clear Dependabot alerts (remaining alerts require dropping Python 3.9)
2527

2628

2729
v 2.2.1

DEVELOPING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Steps:
4646

4747
- Export variables as in one of the `tests/env_templates/*.base.template` examples.
4848
- Export variables as in the `tests/env_templates/env.vectorize-minimal.template` example.
49-
- Run: `uv venv --python ">=3.9,<3.15" && uv run pytest tests/base`
49+
- Run: `uv venv --python ">=3.10,<3.15" && uv run pytest tests/base`
5050

5151
### All available tests/targets
5252

astrapy/data/cursors/farr_cursor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
from collections.abc import Awaitable
17+
from collections.abc import Awaitable, Callable
1818
from copy import deepcopy
1919
from inspect import iscoroutinefunction
20-
from typing import Any, Callable, Generic, cast
20+
from typing import Any, Generic, cast
2121

2222
from astrapy import AsyncCollection, Collection
2323
from astrapy.constants import (

astrapy/data/cursors/find_cursor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
from __future__ import annotations
1616

17-
from collections.abc import Awaitable
17+
from collections.abc import Awaitable, Callable
1818
from copy import deepcopy
1919
from inspect import iscoroutinefunction
20-
from typing import Any, Callable, Generic, cast
20+
from typing import Any, Generic, cast
2121

2222
from astrapy import AsyncCollection, AsyncTable, Collection, Table
2323
from astrapy.constants import (

astrapy/data/info/table_descriptor/table_altering.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from abc import ABC, abstractmethod
1818
from dataclasses import dataclass
19-
from typing import Any, TypeVar, Union, cast
19+
from typing import Any, TypeVar, cast
2020

2121
from astrapy.data.info.table_descriptor.table_columns import (
2222
TableColumnTypeDescriptor,
@@ -273,7 +273,7 @@ def _from_dict(cls, raw_dict: dict[str, Any]) -> AlterTableAddVectorize:
273273
)
274274
return AlterTableAddVectorize(
275275
columns=cast(
276-
dict[str, Union[VectorServiceOptions, dict[str, Any]]],
276+
dict[str, VectorServiceOptions | dict[str, Any]],
277277
_columns,
278278
)
279279
)

astrapy/data/utils/collection_converters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def preprocess_collection_payload_value(
8484

8585
if options.unroll_iterables_to_lists:
8686
_value = ensure_unrolled_if_iterable(_value)
87-
if isinstance(_value, (dict, DataAPIMap)):
87+
if isinstance(_value, dict | DataAPIMap):
8888
return {
8989
k: preprocess_collection_payload_value(path + [k], v, options=options)
9090
for k, v in _value.items()

astrapy/data/utils/distinct_extractors.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,16 @@
1616

1717
import hashlib
1818
import json
19-
from collections.abc import Iterable
20-
from typing import (
21-
Any,
22-
Callable,
23-
Optional,
24-
)
19+
from collections.abc import Callable, Iterable
20+
from typing import Any
2521

2622
from astrapy.data.utils.collection_converters import preprocess_collection_payload_value
2723
from astrapy.data.utils.table_converters import preprocess_table_payload_value
2824
from astrapy.data_types import DataAPIMap, DataAPISet
2925
from astrapy.utils.api_options import FullSerdesOptions
3026
from astrapy.utils.document_paths import unescape_field_path
3127

32-
IndexPairType = tuple[Optional[str], Optional[int]]
28+
IndexPairType = tuple[str | None, int | None]
3329

3430
ERROR_NO_EMPTY_SAFE_KEYSTART = (
3531
"The 'key' parameter for distinct cannot be empty or start with a list index."
@@ -80,7 +76,7 @@ def _extract_with_key_blocks(
8076
key_blocks: list[IndexPairType], value: Any
8177
) -> Iterable[Any]:
8278
if key_blocks == []:
83-
if isinstance(value, (list, set, DataAPISet)):
79+
if isinstance(value, list | set | DataAPISet):
8480
for item in value:
8581
yield item
8682
else:
@@ -91,13 +87,13 @@ def _extract_with_key_blocks(
9187
rest_key_blocks = key_blocks[1:]
9288
key_block = key_blocks[0]
9389
k_str, k_int = key_block
94-
if isinstance(value, (dict, DataAPIMap)):
90+
if isinstance(value, dict | DataAPIMap):
9591
if k_str is not None and k_str in value:
9692
new_value = value[k_str]
9793
for item in _extract_with_key_blocks(rest_key_blocks, new_value):
9894
yield item
9995
return
100-
elif isinstance(value, (list, set, DataAPISet)):
96+
elif isinstance(value, list | set | DataAPISet):
10197
_list_value = list(value)
10298
if k_int is not None:
10399
if len(_list_value) > k_int:

astrapy/data/utils/table_converters.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import json
2323
import logging
2424
import math
25-
from typing import Any, Callable, Generic, cast
25+
from collections.abc import Callable
26+
from typing import Any, Generic, cast
2627

2728
from astrapy.constants import ROW, MapEncodingMode
2829
from astrapy.data.info.table_descriptor.table_columns import (
@@ -117,7 +118,7 @@ def _tpostprocessor_int(raw_value: Any) -> int | None:
117118
def _tpostprocessor_float(raw_value: Any) -> float | None:
118119
if raw_value is None:
119120
return None
120-
elif isinstance(raw_value, (str, decimal.Decimal)):
121+
elif isinstance(raw_value, str | decimal.Decimal):
121122
return float(raw_value)
122123
# just a float already
123124
return cast(float, raw_value)
@@ -668,7 +669,7 @@ def preprocess_table_payload_value(
668669
)
669670
for udt_k, udt_v in udt_dict.items()
670671
}
671-
elif isinstance(value, (dict, DataAPIMap)):
672+
elif isinstance(value, dict | DataAPIMap):
672673
# This is a nesting structure (but not the dict-wrapper for UDTs)
673674
maps_can_become_tuples: bool
674675
if options.encode_maps_as_lists_in_tables == MapEncodingMode.NEVER:
@@ -716,7 +717,7 @@ def preprocess_table_payload_value(
716717
)
717718
for k, v in value.items()
718719
}
719-
elif isinstance(value, (list, set, DataAPISet)):
720+
elif isinstance(value, list | set | DataAPISet):
720721
return [
721722
preprocess_table_payload_value(
722723
path + [""], v, options=options, map2tuple_checker=map2tuple_checker
@@ -792,7 +793,7 @@ def preprocess_table_payload_value(
792793
return value.to_c_string()
793794
elif isinstance(value, UUID):
794795
return str(value)
795-
elif isinstance(value, (ipaddress.IPv4Address, ipaddress.IPv6Address)):
796+
elif isinstance(value, ipaddress.IPv4Address | ipaddress.IPv6Address):
796797
return str(value)
797798
elif isinstance(value, datetime.timedelta):
798799
return DataAPIDuration.from_timedelta(value).to_c_string()
@@ -818,7 +819,7 @@ def preprocess_table_payload_value(
818819
]
819820

820821
# is it a well-known, natively-JSON-serializable type:
821-
if isinstance(_uvalue, (str, int, float, bool, type(None))):
822+
if isinstance(_uvalue, str | int | float | bool | type(None)):
822823
return _uvalue
823824

824825
# check whether instance of a class with a registered serializer:

0 commit comments

Comments
 (0)