From 3c38a8b94c2ea0030ace699c86e1d7046254dde5 Mon Sep 17 00:00:00 2001 From: Maxime Grenu <69890511+cluster2600@users.noreply.github.com> Date: Sat, 28 Feb 2026 07:37:43 +0100 Subject: [PATCH] feat: add Python 3.13 and 3.14 support (#164) * feat: add Python 3.13 and 3.14 support - Add Python 3.13 and 3.14 classifiers to pyproject.toml - Add cp313 and cp314 cibuildwheel build targets - Add Python 3.13 and 3.14 to CI test matrix - Enable allow-prereleases for setup-python (required for 3.14 alpha) Signed-off-by: Maxime Grenu * ci: retrigger (flaky Int4SquaredEuclideanMetric tolerance on linux-x64) Signed-off-by: Maxime Grenu * fix: widen Int4 distance matrix test tolerance from 1e-4 to 5e-4 Int4 quantization uses only 16 levels per dimension (vs 256 for Int8), resulting in larger rounding errors in distance computations. The previous 1e-4 absolute tolerance was too tight and caused flaky failures (observed diff: 1.22e-4 on values ~523.77). The Int8 test already has this EXPECT_NEAR commented out, relying solely on the relative IsAlmostEqual check. Signed-off-by: Maxime Grenu * fix: remove allow-prereleases flag for Python 3.14 Python 3.14 is now a stable release (v3.14.3, released Oct 2025), so allow-prereleases: true is no longer needed in setup-python. Signed-off-by: Maxime Kawawa-Beaudan Signed-off-by: Maxime Grenu --------- Signed-off-by: Maxime Grenu Signed-off-by: Maxime Kawawa-Beaudan --- .github/workflows/main.yml | 5 +++-- pyproject.toml | 4 ++++ tests/core/metric/quantized_integer_metric_test.cc | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fccfaa6..d6feabc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,13 +70,14 @@ jobs: # Build and test matrix (parallel execution) build-and-test: - name: Build & Test (${{ matrix.platform }}) + name: Build & Test (${{ matrix.platform }}, py${{ matrix.python-version }}) needs: lint runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + python-version: ['3.10', '3.13', '3.14'] include: - os: macos-15 platform: macos-arm64 @@ -97,7 +98,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 with: - python-version: '3.10' + python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: 'pyproject.toml' diff --git a/pyproject.toml b/pyproject.toml index d77eeab..3203f38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,8 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Database", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries :: Python Modules", @@ -161,6 +163,8 @@ build = [ "cp310-*", "cp311-*", "cp312-*", + "cp313-*", + "cp314-*", ] build-frontend = "build" test-requires = ["pytest", "numpy"] diff --git a/tests/core/metric/quantized_integer_metric_test.cc b/tests/core/metric/quantized_integer_metric_test.cc index d0deac8..11916ff 100644 --- a/tests/core/metric/quantized_integer_metric_test.cc +++ b/tests/core/metric/quantized_integer_metric_test.cc @@ -516,7 +516,7 @@ void TestDistanceMatrixInt4(const std::string &metric_name) { matrix_compute(&matrix2[0], &query2[0], meta2.dimension(), &result2[0]); for (size_t i = 0; i < batch_size * query_size; ++i) { - EXPECT_NEAR(result1[i], result2[i], 1e-4); + EXPECT_NEAR(result1[i], result2[i], 5e-4); EXPECT_TRUE(IsAlmostEqual(result1[i], result2[i], 1e4)); } }