Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/pypi-build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: |
3.10
3.11
3.12
3.13
Expand Down Expand Up @@ -76,7 +75,7 @@ jobs:
env:
# Ignore 32 bit architectures
CIBW_ARCHS: "auto64"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10,<3.15"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11,<3.15"
# Keep these in sync with Python CI job `cibw-dev-env-smoke-test`
# in .github/workflows/python-ci.yml to catch import-time regressions early.
CIBW_BEFORE_TEST: "uv sync --directory {project} --only-group dev --no-install-project"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
max-parallel: 15
fail-fast: true
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
python: ['3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -54,12 +54,12 @@ jobs:
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
- name: Check uv.lock is up to date
if: matrix.python == '3.10'
if: matrix.python == '3.11'
run: uv lock --check
- name: Install
run: make install
- name: Run linters
if: matrix.python == '3.10'
if: matrix.python == '3.11'
run: make lint
- name: Run unit tests with coverage
run: COVERAGE=1 make test
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/svn-build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: |
3.10
3.11
3.12
3.13
Expand All @@ -70,7 +69,7 @@ jobs:
env:
# Ignore 32 bit architectures
CIBW_ARCHS: "auto64"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10,<3.15"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11,<3.15"
CIBW_BEFORE_TEST: "uv sync --directory {project} --only-group dev --no-install-project"
CIBW_TEST_COMMAND: "uv run --directory {project} pytest tests/avro/test_decoder.py"
# Skip free-threaded (PEP 703) builds until we evaluate decoder_fast support
Expand Down
6 changes: 3 additions & 3 deletions pyiceberg/table/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import itertools
from collections.abc import Iterator
from datetime import datetime, timezone
from datetime import UTC, datetime
from typing import TYPE_CHECKING, Any

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

snapshots.append(
{
"committed_at": datetime.fromtimestamp(snapshot.timestamp_ms / 1000.0, tz=timezone.utc),
"committed_at": datetime.fromtimestamp(snapshot.timestamp_ms / 1000.0, tz=UTC),
"snapshot_id": snapshot.snapshot_id,
"parent_id": snapshot.parent_snapshot_id,
"operation": str(operation),
Expand Down Expand Up @@ -709,7 +709,7 @@ def history(self) -> pa.Table:

history.append(
{
"made_current_at": datetime.fromtimestamp(snapshot_entry.timestamp_ms / 1000.0, tz=timezone.utc),
"made_current_at": datetime.fromtimestamp(snapshot_entry.timestamp_ms / 1000.0, tz=UTC),
"snapshot_id": snapshot_entry.snapshot_id,
"parent_id": snapshot.parent_snapshot_id if snapshot else None,
"is_current_ancestor": snapshot_entry.snapshot_id in ancestors_ids,
Expand Down
2 changes: 1 addition & 1 deletion pyiceberg/typedef.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
Generic,
Literal,
Protocol,
Self,
TypeAlias,
TypeVar,
Union,
Expand All @@ -34,7 +35,6 @@
from uuid import UUID

from pydantic import BaseModel, ConfigDict, RootModel
from typing_extensions import Self

if TYPE_CHECKING:
from pyiceberg.expressions.literals import Literal as IcebergLiteral
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ name = "pyiceberg"
version = "0.12.0"
description = "Apache Iceberg is an open table format for huge analytic datasets"
authors = [{ name = "Apache Software Foundation", email = "dev@iceberg.apache.org" }]
requires-python = ">=3.10"
requires-python = ">=3.11"
readme = "README.md"
license = "Apache-2.0"
license-files = ["LICENSE", "NOTICE"]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand Down Expand Up @@ -249,7 +248,7 @@ markers = [
# Turns a warning into an error
filterwarnings = [
"error",
# Ignore Python version deprecation, end-of-life and unsupported warnings from google.api_core while we still support 3.10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, this error message is still popping up on 3.11. Can you add this back in?

# Ignore Python version deprecation, end-of-life and unsupported warnings from google.api_core while we still support 3.11
"ignore:You are using a (non-supported )?Python version:FutureWarning:google.api_core",
# Python 3.13 sqlite3 module ResourceWarnings for unclosed database connections
"ignore:unclosed database in <sqlite3.Connection object*:ResourceWarning",
Expand Down
6 changes: 3 additions & 3 deletions tests/benchmark/test_memory_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import gc
import tracemalloc
from datetime import datetime, timezone
from datetime import UTC, datetime

import pyarrow as pa
import pytest
Expand All @@ -45,8 +45,8 @@ def generate_test_dataframe() -> pa.Table:
{
"event_type": ["playback"] * n_rows,
"event_origin": ["origin1"] * n_rows,
"event_send_at": [datetime.now(timezone.utc)] * n_rows,
"event_saved_at": [datetime.now(timezone.utc)] * n_rows,
"event_send_at": [datetime.now(UTC)] * n_rows,
"event_saved_at": [datetime.now(UTC)] * n_rows,
"id": list(range(n_rows)),
"reference_id": [f"ref-{i}" for i in range(n_rows)],
}
Expand Down
4 changes: 2 additions & 2 deletions tests/catalog/test_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta
from unittest import mock

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

with mock.patch.object(
AssumeRoleCredentialFetcher,
Expand Down
44 changes: 22 additions & 22 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import time
import uuid
from collections.abc import Generator
from datetime import date, datetime, timezone
from datetime import UTC, date, datetime
from pathlib import Path
from random import choice, randint
from tempfile import TemporaryDirectory
Expand Down Expand Up @@ -2783,9 +2783,9 @@ def spark() -> "SparkSession":
# 'time': [1_000_000, None, 3_000_000], # Example times: 1s, none, and 3s past midnight #Spark does not support time fields
"timestamp": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
"timestamptz": [
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
],
"date": [date(2023, 1, 1), None, date(2023, 3, 1)],
# Not supported by Spark
Expand Down Expand Up @@ -2849,9 +2849,9 @@ def arrow_table_with_null(pa_schema: "pa.Schema") -> "pa.Table":
# Spark does not support time fields
"timestamp": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
"timestamptz": [
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
],
"date": [date(2023, 1, 1), None, date(2023, 3, 1)],
# Not supported by Spark
Expand Down Expand Up @@ -2903,11 +2903,11 @@ def arrow_table_date_timestamps() -> "pa.Table":
None,
],
"timestamptz": [
datetime(2023, 12, 31, 0, 0, 0, tzinfo=timezone.utc),
datetime(2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc),
datetime(2024, 1, 31, 0, 0, 0, tzinfo=timezone.utc),
datetime(2024, 2, 1, 0, 0, 0, tzinfo=timezone.utc),
datetime(2024, 2, 1, 6, 0, 0, tzinfo=timezone.utc),
datetime(2023, 12, 31, 0, 0, 0, tzinfo=UTC),
datetime(2024, 1, 1, 0, 0, 0, tzinfo=UTC),
datetime(2024, 1, 31, 0, 0, 0, tzinfo=UTC),
datetime(2024, 2, 1, 0, 0, 0, tzinfo=UTC),
datetime(2024, 2, 1, 6, 0, 0, tzinfo=UTC),
None,
],
},
Expand Down Expand Up @@ -2963,46 +2963,46 @@ def arrow_table_with_all_timestamp_precisions(arrow_table_schema_with_all_timest
{
"timestamp_s": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
"timestamptz_s": [
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
],
"timestamp_ms": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
"timestamptz_ms": [
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
],
"timestamp_us": [datetime(2023, 1, 1, 19, 25, 00), None, datetime(2023, 3, 1, 19, 25, 00)],
"timestamptz_us": [
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
],
"timestamp_ns": [
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=6),
None,
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=7),
],
"timestamptz_ns": [
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
],
"timestamptz_us_etc_utc": [
datetime(2023, 1, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 00, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 00, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 00, tzinfo=UTC),
],
"timestamptz_ns_z": [
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=6, tz="UTC"),
None,
pd.Timestamp(year=2024, month=7, day=11, hour=3, minute=30, second=0, microsecond=12, nanosecond=7, tz="UTC"),
],
"timestamptz_s_0000": [
datetime(2023, 1, 1, 19, 25, 1, tzinfo=timezone.utc),
datetime(2023, 1, 1, 19, 25, 1, tzinfo=UTC),
None,
datetime(2023, 3, 1, 19, 25, 1, tzinfo=timezone.utc),
datetime(2023, 3, 1, 19, 25, 1, tzinfo=UTC),
],
}
)
Expand Down
2 changes: 1 addition & 1 deletion tests/expressions/test_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import pickle
import uuid
from decimal import Decimal
from typing import assert_type

import pytest
from typing_extensions import assert_type

from pyiceberg.expressions import (
AlwaysFalse,
Expand Down
2 changes: 1 addition & 1 deletion tests/expressions/test_literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
from decimal import Decimal
from typing import (
Any,
assert_type,
)

import pytest
from typing_extensions import assert_type

from pyiceberg.expressions.literals import (
BinaryLiteral,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_rest_scan_planning_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from datetime import date, datetime, time, timedelta, timezone
from datetime import UTC, date, datetime, time, timedelta
from decimal import Decimal
from typing import Any
from uuid import uuid4
Expand Down Expand Up @@ -247,7 +247,7 @@ def test_rest_scan_primitive_types(scan_catalog: RestCatalog, session_catalog: C
table = recreate_table(scan_catalog, identifier, schema=schema)

now = datetime.now()
now_tz = datetime.now(tz=timezone.utc)
now_tz = datetime.now(tz=UTC)
today = date.today()
uuid1, uuid2, uuid3 = uuid4(), uuid4(), uuid4()

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_rest_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
# pylint:disable=redefined-outer-name
from datetime import date, datetime, time, timezone
from datetime import UTC, date, datetime, time
from decimal import Decimal
from typing import Any
from uuid import UUID
Expand Down Expand Up @@ -1110,8 +1110,8 @@ def test_add_required_column(catalog: Catalog) -> None:
(TimestampType(), datetime(1990, 5, 1, 22, 1, 1), datetime(2000, 5, 1, 22, 1, 1)),
(
TimestamptzType(),
datetime(1990, 5, 1, 22, 1, 1, tzinfo=timezone.utc),
datetime(2000, 5, 1, 22, 1, 1, tzinfo=timezone.utc),
datetime(1990, 5, 1, 22, 1, 1, tzinfo=UTC),
datetime(2000, 5, 1, 22, 1, 1, tzinfo=UTC),
),
(BinaryType(), b"123", b"456"),
(FixedType(4), b"1234", b"5678"),
Expand Down
14 changes: 7 additions & 7 deletions tests/io/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import warnings
import zlib
from collections.abc import Iterator
from datetime import date, datetime, timezone
from datetime import UTC, date, datetime
from pathlib import Path
from typing import Any, Literal
from unittest.mock import MagicMock, patch
Expand Down Expand Up @@ -3510,7 +3510,7 @@ def test__to_requested_schema_timestamp_to_timestamptz_projection() -> None:
datetime(2025, 8, 14, 12, 0, 0),
datetime(2025, 8, 14, 13, 0, 0),
],
type=pa.timestamp("us", tz=timezone.utc),
type=pa.timestamp("us", tz=UTC),
)
],
names=["ts_field"],
Expand All @@ -3527,8 +3527,8 @@ def test__to_requested_schema_timestamptz_to_timestamp_projection() -> None:
[
pa.array(
[
datetime(2025, 8, 14, 12, 0, 0, tzinfo=timezone.utc),
datetime(2025, 8, 14, 13, 0, 0, tzinfo=timezone.utc),
datetime(2025, 8, 14, 12, 0, 0, tzinfo=UTC),
datetime(2025, 8, 14, 13, 0, 0, tzinfo=UTC),
],
type=pa.timestamp("us", tz="UTC"),
)
Expand Down Expand Up @@ -3572,8 +3572,8 @@ def test__to_requested_schema_timestamptz_to_timestamp_write_rejects() -> None:
[
pa.array(
[
datetime(2025, 8, 14, 12, 0, 0, tzinfo=timezone.utc),
datetime(2025, 8, 14, 13, 0, 0, tzinfo=timezone.utc),
datetime(2025, 8, 14, 12, 0, 0, tzinfo=UTC),
datetime(2025, 8, 14, 13, 0, 0, tzinfo=UTC),
],
type=pa.timestamp("us", tz="UTC"),
)
Expand All @@ -3599,7 +3599,7 @@ def test_write_file_rejects_timestamptz_to_timestamp(tmp_path: Path) -> None:
table_schema = Schema(NestedField(1, "ts_field", TimestampType(), required=False))
task_schema = Schema(NestedField(1, "ts_field", TimestamptzType(), required=False))

arrow_data = pa.table({"ts_field": [datetime(2025, 8, 14, 12, 0, 0, tzinfo=timezone.utc)]})
arrow_data = pa.table({"ts_field": [datetime(2025, 8, 14, 12, 0, 0, tzinfo=UTC)]})

table_metadata = TableMetadataV2(
location=f"file://{tmp_path}",
Expand Down
2 changes: 1 addition & 1 deletion tests/table/test_partitioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_partition_type_missing_source_field(table_schema_simple: Schema) -> Non
(DateType(), datetime.date(1925, 5, 22)),
(TimeType(), datetime.time(19, 25, 00)),
(TimestampType(), datetime.datetime(2022, 5, 1, 22, 1, 1)),
(TimestamptzType(), datetime.datetime(2022, 5, 1, 22, 1, 1, tzinfo=datetime.timezone.utc)),
(TimestamptzType(), datetime.datetime(2022, 5, 1, 22, 1, 1, tzinfo=datetime.UTC)),
(StringType(), "abc"),
(UUIDType(), UUID("12345678-1234-5678-1234-567812345678").bytes),
(FixedType(5), 'b"\x8e\xd1\x87\x01"'),
Expand Down
Loading
Loading