Skip to content

python: upstream rules_python PR for py_extension linking two CPython import libraries on Windows #9317

Closed

Description

@TrapsterDK

Part of #7119.

Where

  • Upstream bazel-contrib/rules_python python/private/cc/py_extension_rule.bzl (_py_extension_libs_impl) and python/private/cc/py_extension_macro.bzl (win_libs_name, $(locations ...) in user_link_flags). Unfixed on main and 2.5.0-rc0.
  • Our patch: patches/rules_python/single_import_lib.patch.

Fix

  1. After the upstream issue from python: build and import the native extension fixture with clang-cl on Windows arm64 #7119 exists, open a small PR to rules_python with the same change as our patch: py_extension_libs takes py_limited_api and returns one import library (python3.lib/python3t.lib for limited API, else the versioned one).
  2. Regression test: an analysis test under tests/cc/py_extension/ that builds the _<name>_win_libs target for a windows platform with a fake py_cc_toolchain whose libs has both python3.lib and python3XY.lib, and asserts one file for each py_limited_api value. Reuse tests/support/cc_toolchains.
  3. Follow rules_python CONTRIBUTING (conventional commit title, CHANGELOG entry). No Claude trailers upstream.
  4. Link the PR in python: build and import the native extension fixture with clang-cl on Windows arm64 #7119 and in the rules_python row of patches/README.md. Delete the patch, its cli/adopt/src/overrides.rs row and the README row once a release carries the fix.

Activity

  1. added
    P2Improve and finish existing features
    model:sonnetAgent lane: scoped change with stated design, Sonnet
    on Nov 7, 2026
  2. TrapsterDK commented on Nov 7, 2026

    @TrapsterDK
    CollaboratorAuthor

    Upstream PR for the rules_python single import library fix: bazel-contrib/rules_python#4427 (issue bazel-contrib/rules_python#4426). rules_dx README link: #9344. Local patch stays until a release has it (#9342).

  3. added a commit that references this issue on Nov 7, 2026
    01677f4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Improve and finish existing featuresmodel:sonnetAgent lane: scoped change with stated design, Sonnet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions