From 50ffd3e546c51686e468042721704ad59d4e0eac Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Thu, 7 Nov 2024 16:04:51 +0100 Subject: [PATCH] Declare a Python 3.13 toolchain, revert setup.py toolchain arget selection (#1876) The new solution was too smart (read: dense), because it did not account for the fact that we look for the Windows libs of the interpreter building the wheel, not the hermetic one supplying the header files. The fix is to just align the versions again, so that the libs and headers come from the same minor version. --- MODULE.bazel | 1 + setup.py | 14 ++++---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 40e306fa..092ee180 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -27,6 +27,7 @@ python.toolchain( is_default = True, python_version = "3.12", ) +python.toolchain(python_version = "3.13") pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) pip.parse( diff --git a/setup.py b/setup.py index 238d9d89..69cc49da 100644 --- a/setup.py +++ b/setup.py @@ -92,16 +92,10 @@ class BuildBazelExtension(build_ext.build_ext): def bazel_build(self, ext: BazelExtension) -> None: """Runs the bazel build to create the package.""" temp_path = Path(self.build_temp) - if py_limited_api: - # We only need to know the minimum ABI version, - # since it is stable across minor versions by definition. - # The value here is calculated as the minimum of a) the minimum - # Python version required, and b) the stable ABI version target. - # NB: This needs to be kept in sync with [project.requires-python] - # in pyproject.toml. - python_version = "3.12" - else: - python_version = "{0}.{1}".format(*sys.version_info[:2]) + + # We round to the minor version, which makes rules_python + # look up the latest available patch version internally. + python_version = "{0}.{1}".format(*sys.version_info[:2]) bazel_argv = [ "bazel",