From 0cdec5bdb340a83ead7b6715f10ff7f2f60b6d79 Mon Sep 17 00:00:00 2001 From: "shimin.lin" Date: Wed, 2 Dec 2026 21:34:38 +0000 Subject: [PATCH 1/3] 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), ( From 9794a363a6b57c9d26648483ec751939e2152f98 Mon Sep 17 00:00:00 2001 From: "shimin.lin" Date: Wed, 2 Dec 2026 21:35:33 +0000 Subject: [PATCH 2/3] fix(pyo3): require PyArrow 26 on Python 3.11 and newer Signed-off-by: shimin.lin --- .github/workflows/pyo3-checks.yml | 14 +++++------- pyo3/NEXT_CHANGELOG.md | 8 ++----- pyo3/pyproject.toml | 6 ++++- pyo3/tests/test_dependency_bounds.py | 33 +++++++++++++++++----------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pyo3-checks.yml b/.github/workflows/pyo3-checks.yml index 35e4cac7..61b825f4 100644 --- a/.github/workflows/pyo3-checks.yml +++ b/.github/workflows/pyo3-checks.yml @@ -77,15 +77,11 @@ jobs: fail-fast: false matrix: 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 - # change that breaks on the oldest supported pyarrow fails CI - # instead of a user's install. + # Exercise the 26.0.0 floor as well as the latest compatible version. pyarrow: ["latest"] include: - - python-version: "3.12" - pyarrow: "23.0.1" + - python-version: "3.11" + pyarrow: "26.0.0" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -205,8 +201,8 @@ jobs: # Same floor leg as `build-and-test`; see the comment there. pyarrow: ["latest"] include: - - python-version: "3.12" - pyarrow: "23.0.1" + - python-version: "3.11" + pyarrow: "26.0.0" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/pyo3/NEXT_CHANGELOG.md b/pyo3/NEXT_CHANGELOG.md index 28126870..a0182eba 100644 --- a/pyo3/NEXT_CHANGELOG.md +++ b/pyo3/NEXT_CHANGELOG.md @@ -19,12 +19,8 @@ changes go in the root `NEXT_CHANGELOG.md`. ### 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.10 has no fixed pyarrow release available; - upgrade to Python 3.11+ to clear the CVE. +- Require PyArrow 26.x on Python 3.11 and newer to address CVE-2026-92287. + Python 3.10 uses PyArrow 23.x and remains affected by this advisory. ### Updated diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index ee062822..11657c72 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -9,7 +9,11 @@ description = "Python bindings for the Databricks SQL Kernel (PyO3)" requires-python = ">=3.10" license = { text = "Apache-2.0" } authors = [{ name = "Databricks" }] -dependencies = ["pyarrow>=23.0.1,<27"] +# PyArrow 26 fixes CVE-2026-92287 and requires Python 3.11 or newer. +dependencies = [ + "pyarrow>=23.0.1,<24; python_version == '3.10'", + "pyarrow>=26,<27; python_version >= '3.11'", +] # Dev / CI dependencies. PEP 735 standard; uv reads this directly. # CI runs `uv sync --group dev` (no `--frozen`, no committed diff --git a/pyo3/tests/test_dependency_bounds.py b/pyo3/tests/test_dependency_bounds.py index 6a98bd22..d83443a0 100644 --- a/pyo3/tests/test_dependency_bounds.py +++ b/pyo3/tests/test_dependency_bounds.py @@ -25,22 +25,20 @@ from importlib.metadata import requires import pyarrow +import pytest from packaging.requirements import Requirement -from packaging.version import Version -# First pyarrow release without CVE-2026-92287 (apache/arrow#51349). -PYARROW_CVE_2026_92287_FIXED = Version("26.0.0") - -def pyarrow_requirement() -> Requirement: - """The pyarrow requirement whose environment marker matches this interpreter.""" +def pyarrow_requirement(environment: dict[str, str] | None = None) -> Requirement: + """Return the wheel's PyArrow requirement for the given environment.""" matching = [ req for req in (Requirement(r) for r in requires("databricks-sql-kernel") or []) - if req.name == "pyarrow" and (req.marker is None or req.marker.evaluate()) + if req.name == "pyarrow" + and (req.marker is None or req.marker.evaluate(environment)) ] assert len(matching) == 1, ( - f"expected one pyarrow requirement for this interpreter, got {matching}" + f"expected one active pyarrow requirement, got {matching}" ) return matching[0] @@ -52,9 +50,18 @@ def test_installed_pyarrow_satisfies_declared_range(): ) -def test_declared_range_admits_pyarrow_clear_of_cve_2026_92287(): - req = pyarrow_requirement() - assert req.specifier.contains(PYARROW_CVE_2026_92287_FIXED), ( - f"declared range {req.specifier} excludes pyarrow {PYARROW_CVE_2026_92287_FIXED}; " - "consumers could not install a pyarrow clear of CVE-2026-92287" +@pytest.mark.parametrize( + ("python_version", "accepted", "rejected"), + [ + ("3.10", ["23.0.1"], ["23.0.0", "24.0.0", "26.0.0"]), + ("3.11", ["26.0.0", "26.0.1"], ["23.0.1", "25.0.1", "27.0.0"]), + ], +) +def test_wheel_pyarrow_bounds(python_version, accepted, rejected): + req = pyarrow_requirement( + {"python_version": python_version, "python_full_version": f"{python_version}.0"} ) + for version in accepted: + assert version in req.specifier + for version in rejected: + assert version not in req.specifier From f17b3008f79e7ff2573a8e3ef377596852b6a2f5 Mon Sep 17 00:00:00 2001 From: "shimin.lin" Date: Wed, 2 Dec 2026 22:52:21 +0000 Subject: [PATCH 3/3] fix(pyo3): preserve PyArrow 24 and 25 support on Python 3.10 Signed-off-by: shimin.lin --- pyo3/NEXT_CHANGELOG.md | 5 +++-- pyo3/pyproject.toml | 2 +- pyo3/tests/test_dependency_bounds.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyo3/NEXT_CHANGELOG.md b/pyo3/NEXT_CHANGELOG.md index a0182eba..11aea651 100644 --- a/pyo3/NEXT_CHANGELOG.md +++ b/pyo3/NEXT_CHANGELOG.md @@ -19,8 +19,9 @@ changes go in the root `NEXT_CHANGELOG.md`. ### Changed - The Python wheel now requires Python 3.10 or newer. -- Require PyArrow 26.x on Python 3.11 and newer to address CVE-2026-92287. - Python 3.10 uses PyArrow 23.x and remains affected by this advisory. +- On Python 3.11 and newer, the kernel now requires PyArrow 26.x, which fixes + CVE-2026-92287. Because PyArrow 26 requires at least Python 3.11, the kernel + continues to support PyArrow 23.0.1 through 25.x on Python 3.10. ### Updated diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index 11657c72..8684438a 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -11,7 +11,7 @@ license = { text = "Apache-2.0" } authors = [{ name = "Databricks" }] # PyArrow 26 fixes CVE-2026-92287 and requires Python 3.11 or newer. dependencies = [ - "pyarrow>=23.0.1,<24; python_version == '3.10'", + "pyarrow>=23.0.1,<26; python_version == '3.10'", "pyarrow>=26,<27; python_version >= '3.11'", ] diff --git a/pyo3/tests/test_dependency_bounds.py b/pyo3/tests/test_dependency_bounds.py index d83443a0..efe6a76f 100644 --- a/pyo3/tests/test_dependency_bounds.py +++ b/pyo3/tests/test_dependency_bounds.py @@ -53,7 +53,7 @@ def test_installed_pyarrow_satisfies_declared_range(): @pytest.mark.parametrize( ("python_version", "accepted", "rejected"), [ - ("3.10", ["23.0.1"], ["23.0.0", "24.0.0", "26.0.0"]), + ("3.10", ["23.0.1", "24.0.0", "25.0.1"], ["23.0.0", "26.0.0"]), ("3.11", ["26.0.0", "26.0.1"], ["23.0.1", "25.0.1", "27.0.0"]), ], )