Skip to content

Commit 3507fda

Browse files
feat: Python 3.12 (#2559)
Signed-off-by: Anton Kukushkin <[email protected]> Co-authored-by: Leon Luttenberger <[email protected]>
1 parent 8e2a793 commit 3507fda

35 files changed

+2755
-2639
lines changed

.github/workflows/minimal-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: [3.8]
20+
python-version: ["3.8", "3.11", "3.12"]
2121
platform: [ubuntu-latest, macos-latest, windows-latest]
2222

2323
env:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ AWS SDK for pandas can also run your workflows at scale by leveraging [Modin](ht
101101

102102
The quickest way to get started is to use AWS Glue with Ray. Read our [docs](https://aws-sdk-pandas.readthedocs.io/en/3.5.0/scale.html), our blogs ([1](https://aws.amazon.com/blogs/big-data/scale-aws-sdk-for-pandas-workloads-with-aws-glue-for-ray/)/[2](https://aws.amazon.com/blogs/big-data/advanced-patterns-with-aws-sdk-for-pandas-on-aws-glue-for-ray/)), or head to our latest [tutorials](https://github.com/aws/aws-sdk-pandas/tree/main/tutorials) to discover even more features.
103103

104+
> ⚠️ **Ray is currently not available for Python 3.12. While AWS SDK for pandas supports Python 3.12, it cannot be used at scale.**
105+
104106
## [Read The Docs](https://aws-sdk-pandas.readthedocs.io/)
105107

106108
- [**What is AWS SDK for pandas?**](https://aws-sdk-pandas.readthedocs.io/en/3.5.0/about.html)

awswrangler/_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
_logger: logging.Logger = logging.getLogger(__name__)
1717

1818

19-
_ConfigValueType = Union[str, bool, int, float, botocore.config.Config, dict]
19+
_ConfigValueType = Union[str, bool, int, float, botocore.config.Config, Dict[Any, Any]]
2020

2121

2222
class _ConfigArg(NamedTuple):

awswrangler/_databases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _records2df(
160160
for col_values, col_name in zip(tuple(zip(*records)), cols_names): # Transposing
161161
if (dtype is None) or (col_name not in dtype):
162162
if _oracledb_found:
163-
col_values = oracle.handle_oracle_objects(col_values, col_name) # ruff: noqa: PLW2901
163+
col_values = oracle.handle_oracle_objects(col_values, col_name) # type: ignore[arg-type,assignment] # noqa: PLW2901
164164
try:
165165
array: pa.Array = pa.array(obj=col_values, safe=safe) # Creating Arrow array
166166
except pa.ArrowInvalid as ex:
@@ -169,7 +169,7 @@ def _records2df(
169169
try:
170170
if _oracledb_found:
171171
if _should_handle_oracle_objects(dtype[col_name]):
172-
col_values = oracle.handle_oracle_objects(col_values, col_name, dtype)
172+
col_values = oracle.handle_oracle_objects(col_values, col_name, dtype) # type: ignore[arg-type,assignment] # noqa: PLW2901
173173
array = pa.array(obj=col_values, type=dtype[col_name], safe=safe) # Creating Arrow array with dtype
174174
except (pa.ArrowInvalid, pa.ArrowTypeError):
175175
array = pa.array(obj=col_values, safe=safe) # Creating Arrow array

awswrangler/_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def decorator(func: FunctionType) -> FunctionType:
165165

166166
@wraps(func)
167167
def inner(*args: Any, **kwargs: Any) -> Any:
168-
passed_unsupported_kwargs = set(unsupported_kwargs).intersection( # type: ignore
168+
passed_unsupported_kwargs = set(unsupported_kwargs).intersection(
169169
set([key for key, value in kwargs.items() if value is not None])
170170
)
171171

@@ -620,7 +620,7 @@ def ensure_cpu_count(use_threads: Union[bool, int] = True) -> int:
620620
1
621621
622622
"""
623-
if type(use_threads) == int: # pylint: disable=unidiomatic-typecheck
623+
if type(use_threads) == int: # pylint: disable=unidiomatic-typecheck # noqa: E721
624624
if use_threads < 1:
625625
return 1
626626
return use_threads
@@ -736,7 +736,7 @@ def get_credentials_from_session(
736736
) -> botocore.credentials.ReadOnlyCredentials:
737737
"""Get AWS credentials from boto3 session."""
738738
session: boto3.Session = ensure_session(session=boto3_session)
739-
credentials: botocore.credentials.Credentials = session.get_credentials()
739+
credentials: botocore.credentials.Credentials = session.get_credentials() # type: ignore[assignment]
740740
frozen_credentials: botocore.credentials.ReadOnlyCredentials = credentials.get_frozen_credentials()
741741
return frozen_credentials
742742

awswrangler/athena/_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def update_cache(self, items: List[Dict[str, Any]]) -> None:
5050
if oldest_item:
5151
items = list(
5252
filter(
53-
lambda x: x["Status"]["SubmissionDateTime"] > oldest_item["Status"]["SubmissionDateTime"], # type: ignore[arg-type]
53+
lambda x: x["Status"]["SubmissionDateTime"] > oldest_item["Status"]["SubmissionDateTime"],
5454
items,
5555
)
5656
)

awswrangler/athena/_read.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _add_query_metadata_generator(
7474
) -> Iterator[pd.DataFrame]:
7575
"""Add Query Execution metadata to every DF in iterator."""
7676
for df in dfs:
77-
df = _apply_query_metadata(df=df, query_metadata=query_metadata) # ruff: noqa: PLW2901
77+
df = _apply_query_metadata(df=df, query_metadata=query_metadata) # noqa: PLW2901
7878
yield df
7979

8080

awswrangler/athena/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def _parse_describe_table(df: pd.DataFrame) -> pd.DataFrame:
197197
origin_df_dict = df.to_dict()
198198
target_df_dict: Dict[str, List[Union[str, bool]]] = {"Column Name": [], "Type": [], "Partition": [], "Comment": []}
199199
for index, col_name in origin_df_dict["col_name"].items():
200-
col_name = col_name.strip() # ruff: noqa: PLW2901
200+
col_name = col_name.strip() # noqa: PLW2901
201201
if col_name.startswith("#") or not col_name:
202202
pass
203203
elif col_name in target_df_dict["Column Name"]:

awswrangler/cleanrooms/_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def wait_query(
2929
Protected query execution ID
3030
boto3_session : boto3.Session, optional
3131
Boto3 Session. If None, the default boto3 session is used
32+
3233
Returns
3334
-------
3435
Dict[str, Any]

awswrangler/data_api/rds.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def _execute_statement(
165165
def function(sql: str) -> "ExecuteStatementResponseTypeDef":
166166
return self.client.execute_statement(
167167
resourceArn=self.resource_arn,
168-
database=database, # type: ignore[arg-type]
168+
database=database,
169169
sql=sql,
170170
secretArn=self.secret_arn,
171171
includeResultMetadata=True,
@@ -196,7 +196,7 @@ def _batch_execute_statement(
196196
def function(sql: str) -> "BatchExecuteStatementResponseTypeDef":
197197
return self.client.batch_execute_statement(
198198
resourceArn=self.resource_arn,
199-
database=database, # type: ignore[arg-type]
199+
database=database,
200200
sql=sql,
201201
secretArn=self.secret_arn,
202202
**additional_kwargs,
@@ -363,7 +363,7 @@ def _generate_parameters(columns: List[str], values: List[Any]) -> List[Dict[str
363363
parameter_list = []
364364

365365
for col, value in zip(columns, values):
366-
value, type_hint = _create_value_dict(value) # ruff: noqa: PLW2901
366+
value, type_hint = _create_value_dict(value) # noqa: PLW2901
367367

368368
parameter = {
369369
"name": col,

0 commit comments

Comments
 (0)