Skip to content

Commit edfb4b3

Browse files
authored
feat: Remove and redirect py_proto_library to protobuf (#2604)
Protobuf team is taking ownership of `py_proto_library` and the implementation was moved to protobuf repository. Remove py_proto_library from rules_python, to prevent divergent implementations. Make a redirect with a deprecation warning, so that this doesn't break any users. Previously this was attempted in: d0e25cf Work towards #2173, #2543
1 parent 81c6798 commit edfb4b3

File tree

13 files changed

+12
-318
lines changed

13 files changed

+12
-318
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Unreleased changes template.
5252

5353
{#v0-0-0-changed}
5454
### Changed
55+
* (rules) `py_proto_library` is deprecated in favour of the
56+
implementation in https://github.com/protocolbuffers/protobuf. It will be
57+
removed in the future release.
5558
* (pypi) {obj}`pip.override` will now be ignored instead of raising an error,
5659
fixes [#2550](https://github.com/bazelbuild/rules_python/issues/2550).
5760
* (rules) deprecation warnings for deprecated symbols have been turned off by

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bazel_dep(name = "rules_cc", version = "0.0.16")
1010
bazel_dep(name = "platforms", version = "0.0.4")
1111

1212
# Those are loaded only when using py_proto_library
13-
bazel_dep(name = "rules_proto", version = "7.0.2")
13+
# Use py_proto_library directly from protobuf repository
1414
bazel_dep(name = "protobuf", version = "29.0-rc2", repo_name = "com_google_protobuf")
1515

1616
internal_deps = use_extension("//python/private:internal_deps.bzl", "internal_deps")

WORKSPACE

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,3 @@ http_file(
166166
"https://files.pythonhosted.org/packages/50/67/3e966d99a07d60a21a21d7ec016e9e4c2642a86fea251ec68677daf71d4d/numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
167167
],
168168
)
169-
170-
# rules_proto expects //external:python_headers to point at the python headers.
171-
bind(
172-
name = "python_headers",
173-
actual = "//python/cc:current_py_cc_headers",
174-
)

examples/bzlmod/MODULE.bazel

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ local_path_override(
1212
path = "../..",
1313
)
1414

15-
# (py_proto_library specific) We are using rules_proto to define rules_proto targets to be consumed by py_proto_library.
16-
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
17-
1815
# (py_proto_library specific) Add the protobuf library for well-known types (e.g. `Any`, `Timestamp`, etc)
1916
bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf")
2017

examples/bzlmod/py_proto_library/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ py_test(
2020

2121
# Regression test for https://github.com/bazelbuild/rules_python/issues/2515
2222
#
23-
# This test failed before https://github.com/bazelbuild/rules_python/pull/2516
23+
# This test fails before protobuf 30.0 release
2424
# when ran with --legacy_external_runfiles=False (default in Bazel 8.0.0).
2525
native_test(
2626
name = "external_import_test",
2727
src = "@foo_external//:py_binary_with_proto",
28+
tags = ["manual"], # TODO: reenable when com_google_protobuf is upgraded
2829
# Incompatible with Windows: native_test wrapping a py_binary doesn't work
2930
# on Windows.
3031
target_compatible_with = select({

examples/bzlmod/py_proto_library/foo_external/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
load("@rules_proto//proto:defs.bzl", "proto_library")
2-
load("@rules_python//python:proto.bzl", "py_proto_library")
1+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
2+
load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
33
load("@rules_python//python:py_binary.bzl", "py_binary")
44

55
package(default_visibility = ["//visibility:public"])

examples/bzlmod/py_proto_library/foo_external/MODULE.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ module(
55

66
bazel_dep(name = "rules_python", version = "1.0.0")
77
bazel_dep(name = "protobuf", version = "28.2", repo_name = "com_google_protobuf")
8-
bazel_dep(name = "rules_proto", version = "7.0.2")

internal_dev_deps.bzl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,6 @@ def rules_python_internal_deps():
177177
],
178178
)
179179

180-
http_archive(
181-
name = "rules_proto",
182-
sha256 = "904a8097fae42a690c8e08d805210e40cccb069f5f9a0f6727cf4faa7bed2c9c",
183-
strip_prefix = "rules_proto-6.0.0-rc1",
184-
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc1/rules_proto-6.0.0-rc1.tar.gz",
185-
)
186-
187180
http_archive(
188181
name = "com_google_protobuf",
189182
sha256 = "23082dca1ca73a1e9c6cbe40097b41e81f71f3b4d6201e36c134acc30a1b3660",

python/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ bzl_library(
116116
],
117117
visibility = ["//visibility:public"],
118118
deps = [
119-
"//python/private/proto:py_proto_library_bzl",
119+
"@com_google_protobuf//bazel:py_proto_library_bzl",
120120
],
121121
)
122122

python/private/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ filegroup(
3131
name = "distribution",
3232
srcs = glob(["**"]) + [
3333
"//python/private/api:distribution",
34-
"//python/private/proto:distribution",
3534
"//python/private/pypi:distribution",
3635
"//python/private/whl_filegroup:distribution",
3736
"//tools/build_defs/python/private:distribution",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy