Skip to content

Commit 267118b

Browse files
oresttokovenkokevinjqliuCopilot
authored
infra: bump minimum supported Python version to Python 3.11 (#4170)
* Require Python 3.11 Python 3.10 reached end of life on 2026-10-01 and the devguide lists it as unsupported. Current pyarrow and pandas also publish no 3.10 wheels, so a 3.10 install resolved to pyarrow 25.0.1 and pandas 2.3.3 while 3.11 and up resolved to newer versions. Drops the 3.10 classifier and matrix entry, and moves the two once-only CI steps (lock check, linters) to 3.11. The lock loses its pandas 2.3.3 fork, and pyproject loses the google.api_core warning filter that only existed because that library warns on Python versions it does not support. ruff reads requires-python, so it applies the 3.11 rewrites in the same pass: datetime.UTC in place of timezone.utc, and typing.Self in place of typing_extensions.Self where the typing module has it. * Drop Python 3.10 from release builds and restore google.api_core warning filter The cibuildwheel requires-python override and setup-python list still included 3.10, so releases would build cp310 wheels. google.api_core also warns on 3.11, so its FutureWarning filter is still needed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Kevin Liu <kevin.jq.liu@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 4ba3ba4 commit 267118b

18 files changed

Lines changed: 99 additions & 950 deletions

‎.github/workflows/pypi-build-artifacts.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
4848
with:
4949
python-version: |
50-
3.10
5150
3.11
5251
3.12
5352
3.13
@@ -76,7 +75,7 @@ jobs:
7675
env:
7776
# Ignore 32 bit architectures
7877
CIBW_ARCHS: "auto64"
79-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10,<3.15"
78+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11,<3.15"
8079
# Keep these in sync with Python CI job `cibw-dev-env-smoke-test`
8180
# in .github/workflows/python-ci.yml to catch import-time regressions early.
8281
CIBW_BEFORE_TEST: "uv sync --directory {project} --only-group dev --no-install-project"

‎.github/workflows/python-ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
max-parallel: 15
3939
fail-fast: true
4040
matrix:
41-
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
41+
python: ['3.11', '3.12', '3.13', '3.14']
4242

4343
steps:
4444
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -54,12 +54,12 @@ jobs:
5454
- name: Install system dependencies
5555
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
5656
- name: Check uv.lock is up to date
57-
if: matrix.python == '3.10'
57+
if: matrix.python == '3.11'
5858
run: uv lock --check
5959
- name: Install
6060
run: make install
6161
- name: Run linters
62-
if: matrix.python == '3.10'
62+
if: matrix.python == '3.11'
6363
run: make lint
6464
- name: Run unit tests with coverage
6565
run: COVERAGE=1 make test

‎.github/workflows/svn-build-artifacts.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
4848
with:
4949
python-version: |
50-
3.10
5150
3.11
5251
3.12
5352
3.13
@@ -70,7 +69,7 @@ jobs:
7069
env:
7170
# Ignore 32 bit architectures
7271
CIBW_ARCHS: "auto64"
73-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10,<3.15"
72+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11,<3.15"
7473
CIBW_BEFORE_TEST: "uv sync --directory {project} --only-group dev --no-install-project"
7574
CIBW_TEST_COMMAND: "uv run --directory {project} pytest tests/avro/test_decoder.py"
7675
# Skip free-threaded (PEP 703) builds until we evaluate decoder_fast support

‎pyiceberg/table/inspect.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import itertools
2020
from collections.abc import Iterator
21-
from datetime import datetime, timezone
21+
from datetime import UTC, datetime
2222
from typing import TYPE_CHECKING, Any
2323

2424
from pyiceberg.conversions import from_bytes
@@ -135,7 +135,7 @@ def snapshots(self) -> pa.Table:
135135

136136
snapshots.append(
137137
{
138-
"committed_at": datetime.fromtimestamp(snapshot.timestamp_ms / 1000.0, tz=timezone.utc),
138+
"committed_at": datetime.fromtimestamp(snapshot.timestamp_ms / 1000.0, tz=UTC),
139139
"snapshot_id": snapshot.snapshot_id,
140140
"parent_id": snapshot.parent_snapshot_id,
141141
"operation": str(operation),
@@ -709,7 +709,7 @@ def history(self) -> pa.Table:
709709

710710
history.append(
711711
{
712-
"made_current_at": datetime.fromtimestamp(snapshot_entry.timestamp_ms / 1000.0, tz=timezone.utc),
712+
"made_current_at": datetime.fromtimestamp(snapshot_entry.timestamp_ms / 1000.0, tz=UTC),
713713
"snapshot_id": snapshot_entry.snapshot_id,
714714
"parent_id": snapshot.parent_snapshot_id if snapshot else None,
715715
"is_current_ancestor": snapshot_entry.snapshot_id in ancestors_ids,

‎pyiceberg/typedef.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
Generic,
2727
Literal,
2828
Protocol,
29+
Self,
2930
TypeAlias,
3031
TypeVar,
3132
Union,
@@ -34,7 +35,6 @@
3435
from uuid import UUID
3536

3637
from pydantic import BaseModel, ConfigDict, RootModel
37-
from typing_extensions import Self
3838

3939
if TYPE_CHECKING:
4040
from pyiceberg.expressions.literals import Literal as IcebergLiteral

‎pyproject.toml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ name = "pyiceberg"
1919
version = "0.12.0"
2020
description = "Apache Iceberg is an open table format for huge analytic datasets"
2121
authors = [{ name = "Apache Software Foundation", email = "dev@iceberg.apache.org" }]
22-
requires-python = ">=3.10"
22+
requires-python = ">=3.11"
2323
readme = "README.md"
2424
license = "Apache-2.0"
2525
license-files = ["LICENSE", "NOTICE"]
2626
classifiers = [
2727
"Operating System :: OS Independent",
28-
"Programming Language :: Python :: 3.10",
2928
"Programming Language :: Python :: 3.11",
3029
"Programming Language :: Python :: 3.12",
3130
"Programming Language :: Python :: 3.13",
@@ -249,7 +248,7 @@ markers = [
249248
# Turns a warning into an error
250249
filterwarnings = [
251250
"error",
252-
# Ignore Python version deprecation, end-of-life and unsupported warnings from google.api_core while we still support 3.10
251+
# Ignore Python version deprecation, end-of-life and unsupported warnings from google.api_core while we still support 3.11
253252
"ignore:You are using a (non-supported )?Python version:FutureWarning:google.api_core",
254253
# Python 3.13 sqlite3 module ResourceWarnings for unclosed database connections
255254
"ignore:unclosed database in <sqlite3.Connection object*:ResourceWarning",

‎tests/benchmark/test_memory_benchmark.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import gc
2929
import tracemalloc
30-
from datetime import datetime, timezone
30+
from datetime import UTC, datetime
3131

3232
import pyarrow as pa
3333
import pytest
@@ -45,8 +45,8 @@ def generate_test_dataframe() -> pa.Table:
4545
{
4646
"event_type": ["playback"] * n_rows,
4747
"event_origin": ["origin1"] * n_rows,
48-
"event_send_at": [datetime.now(timezone.utc)] * n_rows,
49-
"event_saved_at": [datetime.now(timezone.utc)] * n_rows,
48+
"event_send_at": [datetime.now(UTC)] * n_rows,
49+
"event_saved_at": [datetime.now(UTC)] * n_rows,
5050
"id": list(range(n_rows)),
5151
"reference_id": [f"ref-{i}" for i in range(n_rows)],
5252
}

‎tests/catalog/test_glue.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
from datetime import datetime, timedelta, timezone
17+
from datetime import UTC, datetime, timedelta
1818
from unittest import mock
1919

2020
import boto3
@@ -872,7 +872,7 @@ def test_glue_assume_role_credentials_are_refreshed_before_expiry() -> None:
872872
**{"client.role-arn": "arn:aws:iam::123456789012:role/my-glue-role", "client.region": "us-east-1"},
873873
)
874874
credentials = catalog.glue._request_signer._credentials
875-
now = datetime.now(timezone.utc)
875+
now = datetime.now(UTC)
876876

877877
with mock.patch.object(
878878
AssumeRoleCredentialFetcher,

‎tests/conftest.py‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import time
3232
import uuid
3333
from collections.abc import Generator
34-
from datetime import date, datetime, timezone
34+
from datetime import UTC, date, datetime
3535
from pathlib import Path
3636
from random import choice, randint
3737
from tempfile import TemporaryDirectory
@@ -2783,9 +2783,9 @@ def spark() -> "SparkSession":
27832783
# 'time': [1_000_000, None, 3_000_000], # Example times: 1s, none, and 3s past midnight #Spark does not support time fields
27842784
"timestamp": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
27852785
"timestamptz": [
2786-
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
2786+
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
27872787
None,
2788-
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
2788+
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
27892789
],
27902790
"date": [date(2023, 1, 1), None, date(2023, 3, 1)],
27912791
# Not supported by Spark
@@ -2849,9 +2849,9 @@ def arrow_table_with_null(pa_schema: "pa.Schema") -> "pa.Table":
28492849
# Spark does not support time fields
28502850
"timestamp": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
28512851
"timestamptz": [
2852-
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
2852+
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
28532853
None,
2854-
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
2854+
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
28552855
],
28562856
"date": [date(2023, 1, 1), None, date(2023, 3, 1)],
28572857
# Not supported by Spark
@@ -2903,11 +2903,11 @@ def arrow_table_date_timestamps() -> "pa.Table":
29032903
None,
29042904
],
29052905
"timestamptz": [
2906-
datetime(2023, 12, 31, 0, 0, 0, tzinfo=timezone.utc),
2907-
datetime(2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc),
2908-
datetime(2024, 1, 31, 0, 0, 0, tzinfo=timezone.utc),
2909-
datetime(2024, 2, 1, 0, 0, 0, tzinfo=timezone.utc),
2910-
datetime(2024, 2, 1, 6, 0, 0, tzinfo=timezone.utc),
2906+
datetime(2023, 12, 31, 0, 0, 0, tzinfo=UTC),
2907+
datetime(2024, 1, 1, 0, 0, 0, tzinfo=UTC),
2908+
datetime(2024, 1, 31, 0, 0, 0, tzinfo=UTC),
2909+
datetime(2024, 2, 1, 0, 0, 0, tzinfo=UTC),
2910+
datetime(2024, 2, 1, 6, 0, 0, tzinfo=UTC),
29112911
None,
29122912
],
29132913
},
@@ -2963,46 +2963,46 @@ def arrow_table_with_all_timestamp_precisions(arrow_table_schema_with_all_timest
29632963
{
29642964
"timestamp_s": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
29652965
"timestamptz_s": [
2966-
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
2966+
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
29672967
None,
2968-
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
2968+
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
29692969
],
29702970
"timestamp_ms": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
29712971
"timestamptz_ms": [
2972-
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
2972+
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
29732973
None,
2974-
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
2974+
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
29752975
],
29762976
"timestamp_us": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
29772977
"timestamptz_us": [
2978-
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
2978+
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
29792979
None,
2980-
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
2980+
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
29812981
],
29822982
"timestamp_ns": [
29832983
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=6),
29842984
None,
29852985
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=7),
29862986
],
29872987
"timestamptz_ns": [
2988-
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
2988+
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
29892989
None,
2990-
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
2990+
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
29912991
],
29922992
"timestamptz_us_etc_utc": [
2993-
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
2993+
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
29942994
None,
2995-
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
2995+
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
29962996
],
29972997
"timestamptz_ns_z": [
29982998
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=6, tz="UTC"),
29992999
None,
30003000
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=7, tz="UTC"),
30013001
],
30023002
"timestamptz_s_0000": [
3003-
datetime(2023, 1, 1, 19, 25, 1, tzinfo=timezone.utc),
3003+
datetime(2023, 1, 1, 19, 25, 1, tzinfo=UTC),
30043004
None,
3005-
datetime(2023, 3, 1, 19, 25, 1, tzinfo=timezone.utc),
3005+
datetime(2023, 3, 1, 19, 25, 1, tzinfo=UTC),
30063006
],
30073007
}
30083008
)

‎tests/expressions/test_expressions.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import pickle
2121
import uuid
2222
from decimal import Decimal
23+
from typing import assert_type
2324

2425
import pytest
25-
from typing_extensions import assert_type
2626

2727
from pyiceberg.expressions import (
2828
AlwaysFalse,

0 commit comments

Comments
 (0)