8000 feat: Remove and redirect py_proto_library to protobuf by comius · Pull Request #2604 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content

feat: Remove and redirect py_proto_library to protobuf #2604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ Unreleased changes template.

{#v0-0-0-changed}
### Changed
* (rules) `py_proto_library` is deprecated in favour of the
implementation in https://github.com/protocolbuffers/protobuf. It will be
removed in the future release.
* (pypi) {obj}`pip.override` will now be ignored instead of raising an error,
fixes [#2550](https://github.com/bazelbuild/rules_python/issues/2550).
* (rules) deprecation warnings for deprecated symbols have been turned off by
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "platforms", version = "0.0.4")

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

internal_deps = use_extension("//python/private:internal_deps.bzl", "internal_deps")
Expand Down
6 changes: 0 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,3 @@ http_file(
"https://files.pythonhosted.org/packages/50/67/3e966d99a07d60a21a21d7ec016e9e4c2642a86fea251ec68677daf71d4d/numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
],
)

# rules_proto expects //external:python_headers to point at the python headers.
bind(
name = "python_headers",
actual = "//python/cc:current_py_cc_headers",
)
3 changes: 0 additions & 3 deletions examples/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ local_path_override(
path = "../..",
)

# (py_proto_library specific) We are using rules_proto to define rules_proto targets to be consumed by py_proto_library.
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")

# (py_proto_library specific) Add the protobuf library for well-known types (e.g. `Any`, `Timestamp`, etc)
bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf")

Expand Down
3 changes: 2 additions & 1 deletion examples/bzlmod/py_proto_library/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ py_test(

# Regression test for https://github.com/bazelbuild/rules_python/issues/2515
#
# This test failed before https://github.com/bazelbuild/rules_python/pull/2516
# This test fails before protobuf 30.0 release
# when ran with --legacy_external_runfiles=False (default in Bazel 8.0.0).
native_test(
name = "external_import_test",
src = "@foo_external//:py_binary_with_proto",
tags = ["manual"], # TODO: reenable when com_google_protobuf is upgraded
# Incompatible with Windows: native_test wrapping a py_binary doesn't work
# on Windows.
target_compatible_with = select({
Expand Down
4 changes: 2 additions & 2 deletions examples/bzlmod/py_proto_library/foo_external/BUILD.bazel
8000
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_python//python:proto.bzl", "py_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
load("@rules_python//python:py_binary.bzl", "py_binary")

package(default_visibility = ["//visibility:public"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ module(

bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "protobuf", version = "28.2", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "7.0.2")
7 changes: 0 additions & 7 deletions internal_dev_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,6 @@ def rules_python_internal_deps():
],
)

http_archive(
name = "rules_proto",
sha256 = "904a8097fae42a690c8e08d805210e40cccb069f5f9a0f6727cf4faa7bed2c9c",
strip_prefix = "rules_proto-6.0.0-rc1",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc1/rules_proto-6.0.0-rc1.tar.gz",
)

http_archive(
name = "com_google_protobuf",
sha256 = "23082dca1ca73a1e9c6cbe40097b41e81f71f3b4d6201e36c134acc30a1b3660",
Expand Down
2 changes: 1 addition & 1 deletion python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ bzl_library(
],
visibility = ["//visibility:public"],
deps = [
"//python/private/proto:py_proto_library_bzl",
"@com_google_protobuf//bazel:py_proto_library_bzl",
],
)

Expand Down
1 change: 0 additions & 1 deletion python/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ filegroup(
name = "distribution",
srcs = glob(["**"]) + [
"//python/private/api:distribution",
"//python/private/proto:distribution",
"//python/private/pypi:distribution",
"//python/private/whl_filegroup:distribution",
"//tools/build_defs/python/private:distribution",
Expand Down
48 changes: 0 additions & 48 deletions python/private/proto/BUILD.bazel

This file was deleted.

244 changes: 0 additions & 244 deletions python/private/proto/py_proto_library.bzl

This file was deleted.

Loading
Loading
0