From 357197baccd989c7e549bb8b3febc7397fb6f5db Mon Sep 17 00:00:00 2001 From: Lei Xu Date: Thu, 29 Jan 2026 09:47:50 -0800 Subject: [PATCH] chore!: change support python version from 3.10 to 3.13 (#2955) Python 3.9 is EOL since Oct 2025. and last two pyarrow builts were against python3.10-3.13. * This PR is contributed by codex-gpt5.2 --- .../workflows/build_linux_wheel/action.yml | 2 +- .github/workflows/build_mac_wheel/action.yml | 2 +- .../workflows/build_windows_wheel/action.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/pypi-publish.yml | 18 +++++----- .github/workflows/python.yml | 28 +++++++-------- python/CONTRIBUTING.md | 2 +- python/Cargo.toml | 4 +-- python/pyproject.toml | 6 ++-- python/python/tests/test_pydantic.py | 35 +------------------ 10 files changed, 34 insertions(+), 67 deletions(-) diff --git a/.github/workflows/build_linux_wheel/action.yml b/.github/workflows/build_linux_wheel/action.yml index 6e0146635..78e04789d 100644 --- a/.github/workflows/build_linux_wheel/action.yml +++ b/.github/workflows/build_linux_wheel/action.yml @@ -3,7 +3,7 @@ name: build-linux-wheel description: "Build a manylinux wheel for lance" inputs: python-minor-version: - description: "8, 9, 10, 11, 12" + description: "10, 11, 12, 13" required: true args: description: "--release" diff --git a/.github/workflows/build_mac_wheel/action.yml b/.github/workflows/build_mac_wheel/action.yml index 7dd3af172..b381bc222 100644 --- a/.github/workflows/build_mac_wheel/action.yml +++ b/.github/workflows/build_mac_wheel/action.yml @@ -3,7 +3,7 @@ name: build_wheel description: "Build a lance wheel" inputs: python-minor-version: - description: "8, 9, 10, 11" + description: "10, 11, 12, 13" required: true args: description: "--release" diff --git a/.github/workflows/build_windows_wheel/action.yml b/.github/workflows/build_windows_wheel/action.yml index 03ba12e0f..34251850a 100644 --- a/.github/workflows/build_windows_wheel/action.yml +++ b/.github/workflows/build_windows_wheel/action.yml @@ -3,7 +3,7 @@ name: build_wheel description: "Build a lance wheel" inputs: python-minor-version: - description: "8, 9, 10, 11" + description: "10, 11, 12, 13, 14" required: true args: description: "--release" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a325ad1b7..6b88c4445 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -41,7 +41,7 @@ jobs: sudo apt install -y protobuf-compiler libssl-dev rustup update && rustup default - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.10" cache: "pip" diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 4cbc64a32..152be52fb 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -44,12 +44,12 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: - python-version: 3.8 + python-version: "3.10" - uses: ./.github/workflows/build_linux_wheel with: - python-minor-version: 8 + python-minor-version: 10 args: "--release --strip ${{ matrix.config.extra_args }}" arm-build: ${{ matrix.config.platform == 'aarch64' }} manylinux: ${{ matrix.config.manylinux }} @@ -74,12 +74,12 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: - python-version: 3.12 + python-version: "3.13" - uses: ./.github/workflows/build_mac_wheel with: - python-minor-version: 8 + python-minor-version: 10 args: "--release --strip --target ${{ matrix.config.target }} --features fp16kernels" - uses: ./.github/workflows/upload_wheel if: startsWith(github.ref, 'refs/tags/python-v') @@ -95,12 +95,12 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: - python-version: 3.12 + python-version: "3.13" - uses: ./.github/workflows/build_windows_wheel with: - python-minor-version: 8 + python-minor-version: 10 args: "--release --strip" vcpkg_token: ${{ secrets.VCPKG_GITHUB_PACKAGES }} - uses: ./.github/workflows/upload_wheel diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 2b4c650b2..b837a633f 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -36,9 +36,9 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: "3.12" + python-version: "3.13" - name: Install ruff run: | pip install ruff==0.9.9 @@ -61,9 +61,9 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: "3.12" + python-version: "3.13" - name: Install protobuf compiler run: | sudo apt update @@ -90,9 +90,9 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: "3.12" + python-version: "3.13" cache: "pip" - name: Install protobuf run: | @@ -110,7 +110,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - python-minor-version: ["9", "12"] + python-minor-version: ["10", "13"] runs-on: "ubuntu-24.04" defaults: run: @@ -126,7 +126,7 @@ jobs: sudo apt update sudo apt install -y protobuf-compiler - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: 3.${{ matrix.python-minor-version }} - uses: ./.github/workflows/build_linux_wheel @@ -156,9 +156,9 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: "3.12" + python-version: "3.13" - uses: ./.github/workflows/build_mac_wheel with: args: --profile ci @@ -185,9 +185,9 @@ jobs: fetch-depth: 0 lfs: true - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: "3.12" + python-version: "3.13" - uses: ./.github/workflows/build_windows_wheel with: args: --profile ci @@ -212,9 +212,9 @@ jobs: sudo apt update sudo apt install -y protobuf-compiler - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: 3.9 + python-version: "3.10" - name: Install lancedb run: | pip install "pydantic<2" diff --git a/python/CONTRIBUTING.md b/python/CONTRIBUTING.md index 588399bc0..122677364 100644 --- a/python/CONTRIBUTING.md +++ b/python/CONTRIBUTING.md @@ -16,7 +16,7 @@ The Python package is a wrapper around the Rust library, `lancedb`. We use To set up your development environment, you will need to install the following: -1. Python 3.9 or later +1. Python 3.10 or later 2. Cargo (Rust's package manager). Use [rustup](https://rustup.rs/) to install. 3. [protoc](https://grpc.io/docs/protoc-installation/) (Protocol Buffers compiler) diff --git a/python/Cargo.toml b/python/Cargo.toml index 84b560464..536e27c4e 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -21,7 +21,7 @@ lance-core.workspace = true lance-namespace.workspace = true lance-io.workspace = true env_logger.workspace = true -pyo3 = { version = "0.25", features = ["extension-module", "abi3-py39"] } +pyo3 = { version = "0.25", features = ["extension-module", "abi3-py310"] } pyo3-async-runtimes = { version = "0.25", features = [ "attributes", "tokio-runtime", @@ -34,7 +34,7 @@ tokio = { version = "1.40", features = ["sync"] } [build-dependencies] pyo3-build-config = { version = "0.25", features = [ "extension-module", - "abi3-py39", + "abi3-py310", ] } [features] diff --git a/python/pyproject.toml b/python/pyproject.toml index c88a4f0b5..b6fe79b9c 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -16,7 +16,7 @@ description = "lancedb" authors = [{ name = "LanceDB Devs", email = "dev@lancedb.com" }] license = { file = "LICENSE" } readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = [ "data-format", "data-science", @@ -33,10 +33,10 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering", ] @@ -137,4 +137,4 @@ include = [ "python/lancedb/_lancedb.pyi", ] exclude = ["python/tests/"] -pythonVersion = "3.12" +pythonVersion = "3.13" diff --git a/python/python/tests/test_pydantic.py b/python/python/tests/test_pydantic.py index 2a889e7e5..fd0bb2c64 100644 --- a/python/python/tests/test_pydantic.py +++ b/python/python/tests/test_pydantic.py @@ -2,7 +2,6 @@ # SPDX-FileCopyrightText: Copyright The LanceDB Authors import json -import sys from datetime import date, datetime from typing import List, Optional, Tuple @@ -20,10 +19,6 @@ from pydantic import BaseModel from pydantic import Field -@pytest.mark.skipif( - sys.version_info < (3, 9), - reason="using native type alias requires python3.9 or higher", -) def test_pydantic_to_arrow(): class StructModel(pydantic.BaseModel): a: str @@ -83,10 +78,6 @@ def test_pydantic_to_arrow(): assert schema == expect_schema -@pytest.mark.skipif( - sys.version_info < (3, 10), - reason="using | type syntax requires python3.10 or higher", -) def test_optional_types_py310(): class TestModel(pydantic.BaseModel): a: str | None @@ -105,11 +96,7 @@ def test_optional_types_py310(): assert schema == expect_schema -@pytest.mark.skipif( - sys.version_info < (3, 10), - reason="using PEP 604 union types requires python3.10 or higher", -) -def test_optional_structs_py310(): +def test_optional_structs(): class SplitInfo(pydantic.BaseModel): start_frame: int end_frame: int @@ -138,10 +125,6 @@ def test_optional_structs_py310(): assert schema == expect_schema -@pytest.mark.skipif( - sys.version_info < (3, 10), - reason="using PEP 604 union types requires python3.10 or higher", -) def test_optional_struct_list_py310(): class SplitInfo(pydantic.BaseModel): start_frame: int @@ -173,10 +156,6 @@ def test_optional_struct_list_py310(): assert schema == expect_schema -@pytest.mark.skipif( - sys.version_info < (3, 9), - reason="using native type alias requires python3.9 or higher", -) def test_nested_struct_list(): class SplitInfo(pydantic.BaseModel): start_frame: int @@ -208,10 +187,6 @@ def test_nested_struct_list(): assert schema == expect_schema -@pytest.mark.skipif( - sys.version_info < (3, 9), - reason="using native type alias requires python3.9 or higher", -) def test_nested_struct_list_optional(): class SplitInfo(pydantic.BaseModel): start_frame: int @@ -313,10 +288,6 @@ def test_nested_struct_list_optional_container_and_items(): assert schema == expect_schema -@pytest.mark.skipif( - sys.version_info < (3, 10), - reason="using PEP 604 union types requires python3.10 or higher", -) def test_nested_struct_list_optional_items_pep604(): class SplitInfo(pydantic.BaseModel): start_frame: int @@ -352,10 +323,6 @@ def test_nested_struct_list_optional_items_pep604(): assert schema == expect_schema -@pytest.mark.skipif( - sys.version_info > (3, 8), - reason="using native type alias requires python3.9 or higher", -) def test_pydantic_to_arrow_py38(): class StructModel(pydantic.BaseModel): a: str