From 82dcce33d7e0160a2150a7fad6ae70aabd615acb Mon Sep 17 00:00:00 2001 From: Vikrant Puppala Date: Thu, 11 Jun 2026 06:36:32 +0000 Subject: [PATCH] feat(pyo3): support Python 3.9 (abi3-py39 + pyarrow env-marker split) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lowers the PyO3 wheel floor from 3.10 to 3.9. The abi3 stable-ABI build means a single artifact covers the whole supported range, so no Rust changes were needed — only the ABI/floor pins. - Cargo.toml: abi3-py310 -> abi3-py39 (wheel tag cp39-abi3). - pyproject.toml: requires-python >=3.9, and split the pyarrow dependency by interpreter via PEP 508 env markers. pyarrow 23.x dropped 3.9 wheels, so 3.9 takes the last 3.9-capable series (>=14,<19) while 3.10+ keeps the connector-5.0.0-aligned >=23.0.1 floor (needed for cp314 wheels). Both ceilings preserve the go/pinning-python-deps major-version upper bound. - pyo3-checks.yml: add 3.9 to the CI matrix, exercising the older pyarrow path. Signed-off-by: Vikrant Puppala --- .github/workflows/pyo3-checks.yml | 8 ++++--- pyo3/Cargo.toml | 8 +++---- pyo3/pyproject.toml | 36 ++++++++++++++++++++----------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pyo3-checks.yml b/.github/workflows/pyo3-checks.yml index 2623a230..8153c749 100644 --- a/.github/workflows/pyo3-checks.yml +++ b/.github/workflows/pyo3-checks.yml @@ -101,9 +101,11 @@ jobs: 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.10 — matches - # `requires-python` in pyo3/pyproject.toml. - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + # 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"] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/pyo3/Cargo.toml b/pyo3/Cargo.toml index e77be36f..179e1fcd 100644 --- a/pyo3/Cargo.toml +++ b/pyo3/Cargo.toml @@ -67,12 +67,12 @@ crate-type = ["cdylib", "rlib"] # kernel's default feature. databricks-sql-kernel = { path = "..", default-features = false, features = ["tls-rustls"] } -# pyo3 — abi3-py310 builds a single stable-ABI wheel (tagged -# cp310-abi3) that loads on CPython 3.10+. The ABI floor is kept in -# step with `requires-python = ">=3.10"` in pyproject.toml; bumping +# 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.26", features = ["extension-module", "abi3-py310"] } +pyo3 = { version = "0.26", features = ["extension-module", "abi3-py39"] } # Multi-thread runtime — one per Session, owned on the Rust side. tokio = { version = "1", features = ["rt-multi-thread"] } diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index 64ad4ea8..dc0680ca 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -7,9 +7,10 @@ name = "databricks-sql-kernel" version = "0.2.0" description = "Python bindings for the Databricks SQL Kernel (PyO3)" # Floor matches the tested CI matrix in -# .github/workflows/pyo3-checks.yml (3.10 .. 3.14). 3.9 is no longer -# exercised in CI, so it is not claimed as supported here. -requires-python = ">=3.10" +# .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" license = { text = "Apache-2.0" } authors = [{ name = "Databricks" }] # Runtime dependency for downstream consumers. Major-version bound @@ -20,15 +21,26 @@ authors = [{ name = "Databricks" }] # `[dependency-groups].dev` block below + the workflow comment in # `.github/workflows/pyo3-checks.yml` for the policy rationale. # -# Floor is `>=23.0.1` to match databricks-sql-connector 5.0.0 -# (databricks/databricks-sql-python#818): pyarrow only ships cp314 -# (Python 3.14) wheels from 23.x onward, so the previous `<19` ceiling -# forced a from-source build that fails on 3.14. Keeping the floor -# aligned with the connector also keeps the two surfaces installable -# side by side. The `<24` ceiling preserves 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,<24"] +# Split by interpreter via PEP 508 environment markers because the +# two ends of the supported range need different pyarrow floors: +# +# * Python 3.10+: `>=23.0.1` matches databricks-sql-connector 5.0.0 +# (databricks/databricks-sql-python#818). pyarrow only ships cp314 +# (Python 3.14) wheels from 23.x onward, so an older ceiling forces +# a from-source build that fails on 3.14. Keeping the floor aligned +# with the connector also keeps the two surfaces installable side +# by side. +# * 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 `<24` / `<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,<24; python_version >= '3.10'", + "pyarrow>=14,<19; python_version < '3.10'", +] # Dev / CI dependencies. PEP 735 standard; uv reads this directly. # CI runs `uv sync --group dev` (no `--frozen`, no committed