From 0cdec5bdb340a83ead7b6715f10ff7f2f60b6d79 Mon Sep 17 00:00:00 2001 From: "shimin.lin" Date: Wed, 2 Dec 2026 21:34:38 +0000 Subject: [PATCH] build(pyo3): drop support for Python 3.9 Signed-off-by: shimin.lin --- .github/workflows/pyo3-checks.yml | 10 ++------- CLAUDE.md | 2 +- pyo3/Cargo.toml | 8 ++----- pyo3/NEXT_CHANGELOG.md | 3 ++- pyo3/pyproject.toml | 32 ++-------------------------- pyo3/src/errors.rs | 2 +- pyo3/src/logging.rs | 2 +- pyo3/tests/test_dependency_bounds.py | 3 --- 8 files changed, 11 insertions(+), 51 deletions(-) diff --git a/.github/workflows/pyo3-checks.yml b/.github/workflows/pyo3-checks.yml index 5303cd4d..35e4cac7 100644 --- a/.github/workflows/pyo3-checks.yml +++ b/.github/workflows/pyo3-checks.yml @@ -76,13 +76,7 @@ jobs: strategy: fail-fast: false matrix: - # Cover the supported floor through the newest release. 3.13 - # and 3.14 exercise the GIL / free-threading changes where - # PyO3 extensions most often break. Floor is 3.9 — matches - # `requires-python` in pyo3/pyproject.toml. (3.9 also resolves - # the older `pyarrow>=14,<19` series via the env-marker split - # in pyproject.toml, exercising that path in CI.) - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] # `uv sync` resolves the newest pyarrow inside the declared bound, # so the default legs only ever see the top of `>=23.0.1,<27`. # The include below adds one leg pinned to the floor, so a kernel @@ -207,7 +201,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] # Same floor leg as `build-and-test`; see the comment there. pyarrow: ["latest"] include: diff --git a/CLAUDE.md b/CLAUDE.md index f5123a2d..07aad87b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -124,7 +124,7 @@ How this shows up in the repo: - **Python dep pinning follows the externally-published-library rule from [go/pinning-python-deps](https://docs.google.com/document/d/1thJsoOBW3NzvRV6pWpujcD8mn4KOXgAW8t10iw6Z6LA/edit)**: major-version upper bounds in `pyo3/pyproject.toml` - (`pyarrow>=14,<19`), no exact pins, no transitive constraints, + with no exact pins, no transitive constraints, no committed lockfile. Exact pins would impede downstream `pip install databricks-sql-kernel` for end-users with their own pyarrow consumers. Trusted jobs use `db-pypi`, whose 7-day age filter is diff --git a/pyo3/Cargo.toml b/pyo3/Cargo.toml index 7b6270f2..b4caf012 100644 --- a/pyo3/Cargo.toml +++ b/pyo3/Cargo.toml @@ -74,12 +74,8 @@ extension-module = ["pyo3/extension-module"] # kernel's default feature. databricks-sql-kernel = { path = "..", default-features = false, features = ["tls-rustls"] } -# pyo3 — abi3-py39 builds a single stable-ABI wheel (tagged -# cp39-abi3) that loads on CPython 3.9+. The ABI floor is kept in -# step with `requires-python = ">=3.9"` in pyproject.toml; bumping -# both together avoids shipping a wheel whose ABI tag advertises an -# interpreter the package no longer claims to support. -pyo3 = { version = "0.29", features = ["abi3-py39"] } +# Match the stable ABI floor to the minimum supported Python version. +pyo3 = { version = "0.29", features = ["abi3-py310"] } # Multi-thread runtime — one per Session, owned on the Rust side. tokio = { version = "1", features = ["rt-multi-thread"] } diff --git a/pyo3/NEXT_CHANGELOG.md b/pyo3/NEXT_CHANGELOG.md index d8233cd8..28126870 100644 --- a/pyo3/NEXT_CHANGELOG.md +++ b/pyo3/NEXT_CHANGELOG.md @@ -18,11 +18,12 @@ changes go in the root `NEXT_CHANGELOG.md`. raises `KernelError` (`InvalidArgument`). ### Changed +- The Python wheel now requires Python 3.10 or newer. - Allow pyarrow 24.x through 26.x on Python 3.10+ (`pyarrow>=23.0.1,<27`), so the wheel installs alongside pyarrow 26, the first release clear of CVE-2026-92287. Fresh `[kernel]` installs without their own pyarrow pin now resolve pyarrow 26 on Python 3.11+ (25.x on 3.10); pin `pyarrow<24` to stay - on 23.x. Python 3.9/3.10 have no fixed pyarrow release available; + on 23.x. Python 3.10 has no fixed pyarrow release available; upgrade to Python 3.11+ to clear the CVE. ### Updated diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index 9d8c1109..ee062822 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -6,38 +6,10 @@ build-backend = "maturin" name = "databricks-sql-kernel" version = "1.5.0" description = "Python bindings for the Databricks SQL Kernel (PyO3)" -# Floor matches the tested CI matrix in -# .github/workflows/pyo3-checks.yml (3.9 .. 3.14). The abi3-py39 -# wheel (see pyo3/Cargo.toml) loads on every CPython at or above -# this floor from a single artifact. -requires-python = ">=3.9" +requires-python = ">=3.10" license = { text = "Apache-2.0" } authors = [{ name = "Databricks" }] -# Runtime dependency for downstream consumers. Major-version bound -# per the go/pinning-python-deps externally-published-library rule: -# exact pins make this wheel harder for end-users to install -# alongside their own pyarrow consumers. The CI environment also -# uses these bounds (no committed lockfile) — see the -# `[dependency-groups].dev` block below + the workflow comment in -# `.github/workflows/pyo3-checks.yml` for the policy rationale. -# -# Split by interpreter via PEP 508 environment markers because the -# two ends of the supported range need different pyarrow floors: -# -# * Python 3.10+: retain the connector's >=23.0.1 floor; <27 admits -# the CVE-2026-92287 fix in 26.x, which requires Python 3.11+. -# Python 3.10 resolves to 25.x. -# * Python 3.9: pyarrow 23.x dropped 3.9 wheels, so 3.9 takes the -# last series that still ships them (`>=14,<19`). 3.9 never sees -# 3.14, so the cp314 concern does not apply here. -# -# Both `<27` / `<19` ceilings preserve the major-version upper bound -# the go/pinning-python-deps policy requires (a future pyarrow major -# then surfaces as a deliberate bump, not a silent auto-resolve). -dependencies = [ - "pyarrow>=23.0.1,<27; python_version >= '3.10'", - "pyarrow>=14,<19; python_version < '3.10'", -] +dependencies = ["pyarrow>=23.0.1,<27"] # Dev / CI dependencies. PEP 735 standard; uv reads this directly. # CI runs `uv sync --group dev` (no `--frozen`, no committed diff --git a/pyo3/src/errors.rs b/pyo3/src/errors.rs index 88ff4257..26397390 100644 --- a/pyo3/src/errors.rs +++ b/pyo3/src/errors.rs @@ -18,7 +18,7 @@ //! Subclassing native exception types is not allowed in `abi3` mode //! (PyO3 emits a compile-time error: "with the abi3 feature enabled, //! PyO3 does not support subclassing native types"). To keep one -//! wheel per platform across Python 3.9+, `KernelError` is built +//! wheel per platform across supported Python versions, `KernelError` is built //! via `create_exception!` (subclasses `Exception` at the Python C //! level, not at the Rust pyclass level) and the structured fields //! are attached as Python attributes via `setattr` so callers still diff --git a/pyo3/src/logging.rs b/pyo3/src/logging.rs index cdb331c6..bf4f9940 100644 --- a/pyo3/src/logging.rs +++ b/pyo3/src/logging.rs @@ -65,7 +65,7 @@ //! //! Runtime workers can outlive their handle (`KernelRuntime`'s `Drop` //! doesn't wait for them), and pyo3's finalization check is compiled out -//! under `abi3-py39`, so a worker forwarding a record while the +//! at our stable ABI floor, so a worker forwarding a record while the //! interpreter finalizes can abort the process. An `atexit` hook, which //! runs before finalization starts, makes the bridge drop records from //! then on. diff --git a/pyo3/tests/test_dependency_bounds.py b/pyo3/tests/test_dependency_bounds.py index 3609f9cd..6a98bd22 100644 --- a/pyo3/tests/test_dependency_bounds.py +++ b/pyo3/tests/test_dependency_bounds.py @@ -22,11 +22,9 @@ from __future__ import annotations -import sys from importlib.metadata import requires import pyarrow -import pytest from packaging.requirements import Requirement from packaging.version import Version @@ -54,7 +52,6 @@ def test_installed_pyarrow_satisfies_declared_range(): ) -@pytest.mark.skipif(sys.version_info < (3, 10), reason="Python 3.9 caps pyarrow at <19") def test_declared_range_admits_pyarrow_clear_of_cve_2026_92287(): req = pyarrow_requirement() assert req.specifier.contains(PYARROW_CVE_2026_92287_FIXED), (