From 1567357ad34b749123e414f5ad5f49fe59a97ac1 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Mon, 27 Apr 2026 01:19:36 +0900 Subject: [PATCH] refactor(twine): use py_binary for publishing in WORKSPACE (#3734) Remove the reliance on defunct entry point code. Work towards #3642. --- python/BUILD.bazel | 2 +- python/packaging.bzl | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 6577ff805f..90b2225ab5 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -88,7 +88,7 @@ bzl_library( name = "packaging_bzl", srcs = ["packaging.bzl"], deps = [ - ":py_binary_bzl", + "//python/entry_points:py_console_script_binary_bzl", "//python/private:bzlmod_enabled_bzl", "//python/private:py_package_bzl", "//python/private:py_wheel_bzl", diff --git a/python/packaging.bzl b/python/packaging.bzl index 223aba142d..537aa6090f 100644 --- a/python/packaging.bzl +++ b/python/packaging.bzl @@ -216,19 +216,12 @@ def py_wheel( **copy_propagating_kwargs(kwargs) ) elif twine: - if not twine.endswith(":pkg"): - fail("twine label should look like @my_twine_repo//:pkg") - - twine_main = twine.replace(":pkg", ":rules_python_wheel_entry_point_twine.py") - py_binary( name = "{}.publish".format(name), - srcs = [twine_main], + deps = [twine], args = twine_args, data = [dist_target], - imports = ["."], - main = twine_main, - deps = [twine], + main_module = "twine", tags = manual_tags, visibility = kwargs.get("visibility"), **copy_propagating_kwargs(kwargs)