Skip to content

Commit 9ab0fab

Browse files
committed
Give up on Python example
1 parent 15dcfe6 commit 9ab0fab

File tree

9 files changed

+7
-78
lines changed

9 files changed

+7
-78
lines changed

examples/.bazelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# The main ingredient: allow us to register toolchains other than com_google_protobuf targets
22
common --incompatible_enable_proto_toolchain_resolution
3-
common --@aspect_rules_py//py:interpreter_version=3.9.18
43

54
# Force rules_go to disable CGO even though we have a (fake) C++ toolchain registered.
65
common --host_platform=//tools:no_cgo_host_platform

examples/BUILD.bazel

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
load("@rules_go//proto:def.bzl", "go_proto_library")
22
load("@rules_proto//proto:defs.bzl", "proto_library")
3-
load("@rules_python//python:proto.bzl", "py_proto_library")
43

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

@@ -10,11 +9,6 @@ proto_library(
109
deps = ["@com_google_protobuf//:any_proto"],
1110
)
1211

13-
py_proto_library(
14-
name = "foo_py_proto",
15-
deps = [":foo_proto"],
16-
)
17-
1812
java_proto_library(
1913
name = "foo_java_proto",
2014
deps = [":foo_proto"],

examples/MODULE.bazel

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
bazel_dep(name = "toolchains_protoc", version = "0.0.0")
22
bazel_dep(name = "aspect_bazel_lib", version = "2.11.0")
3-
bazel_dep(name = "aspect_rules_py", version = "1.0.0")
43
bazel_dep(name = "platforms", version = "0.0.11")
54
bazel_dep(name = "rules_java", version = "8.6.3")
65
bazel_dep(name = "rules_proto", version = "7.1.0")
7-
bazel_dep(name = "rules_python", version = "1.0.0")
86
bazel_dep(name = "rules_go", version = "0.52.0")
9-
bazel_dep(name = "rules_uv", version = "0.10.0")
107

118
# This example is in the same repo with the ruleset, so we should point to the code at HEAD
129
# rather than use any release on the Bazel Central Registry.
@@ -35,16 +32,6 @@ register_toolchains("@toolchains_protoc_hub//:all")
3532
# Declared toolchains should be created with the 'toolchain' rule and should not have dependencies that themselves require toolchains.
3633
register_toolchains("//tools/toolchains:all")
3734

38-
####### PYTHON ##########
39-
# Shows how a typical Python user fetches all the dependencies of their app, including the protobuf runtime
40-
dev_pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
41-
dev_pip.parse(
42-
hub_name = "pypi",
43-
python_version = "3.11",
44-
requirements_lock = "//tools:requirements.txt",
45-
)
46-
use_repo(dev_pip, "pypi")
47-
4835
####### JAVA ##########
4936
# Note: this is simpler than using rules_jvm_external with a maven installation,
5037
# however it can cause version skew on the classpath if Coursier resolves a different version

examples/python/BUILD

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/python/message_test.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/tools/BUILD.bazel

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS")
2-
load("@rules_uv//uv:pip.bzl", "pip_compile")
3-
4-
pip_compile(
5-
name = "generate_requirements_txt",
6-
requirements_in = "requirements.in",
7-
requirements_txt = "requirements.txt",
8-
)
92

103
# Don't allow rules_go to compile the Go SDK with cgo enabled, as that
114
# would cause a dependency on a functional C++ toolchain.

examples/tools/requirements.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/tools/requirements.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/tools/toolchains/BUILD.bazel

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
"""Define a non-functional cc toolchain.
1+
"""Define our toolchains.
2+
3+
proto_lang_toolchain is used to configure language-specific proto bindings
4+
so long as they honor Bazel's toolchain resolution.
5+
See https://github.com/bazelbuild/rules_proto/discussions/213
26
37
To fail-fast in cases where we are forced to compile third-party C++ code,
4-
define a cc toolchain that doesn't work, by using 'false' as the compiler.
8+
also define a cc toolchain that doesn't work, by using 'false' as the compiler.
59
See https://bazel.build/tutorials/ccp-toolchain-config
610
"""
711

812
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
913
load("defs.bzl", "cc_toolchain_config")
1014

11-
# Configure protoc to have the right arguments for generating Python stubs.
12-
# NB: the protobuf team intends to remove --python_out and instead use a protoc plugin for Python stub emit.
13-
proto_lang_toolchain(
14-
name = "protoc_py_toolchain",
15-
command_line = "--python_out=%s",
16-
progress_message = "Generating Python proto_library %{label}",
17-
runtime = "@pypi//protobuf",
18-
toolchain_type = "@rules_python//python/proto:toolchain_type",
19-
)
20-
21-
# Same as above, but for Java
15+
# Configure protoc to have the neeeded arguments to generate Java stubs.
2216
proto_lang_toolchain(
2317
name = "protoc_java_toolchain",
2418
command_line = "--java_out=%s",

0 commit comments

Comments
 (0)