Confusing error message if rules_proto isn't loaded
🐞 bug report
Affected Rule
The issue is caused by the rule: py_proto_libraryIs this a regression?
NoDescription
A clear and concise description of the problem...If rules_proto isn't loaded, using py_proto_library fails with a somewhat confusing error message:
ERROR: Traceback (most recent call last):
File "[…]/external/rules_python/python/private/proto/py_proto_library.bzl", line 20, column 38, in <toplevel>
ProtoLangToolchainInfo = proto_common.ProtoLangToolchainInfo
Error: 'proto_common' value has no field or method 'ProtoLangToolchainInfo'
Maybe the error message could be improved slightly, e.g. by checking hasattr(proto_common, 'ProtoLangToolchainInfo').
🔬 Minimal Reproduction
WORKSPACE:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "29a801171f7ca190c543406f9894abf2d483c206e14d6acbd695623662320097",
strip_prefix = "rules_python-0.18.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.18.1/rules_python-0.18.1.tar.gz",
)
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
BUILD:
load("@rules_python//python:proto.bzl", "py_proto_library")
py_proto_library(
name = "test_py_pb2",
deps = [":test_proto"],
)
proto_library(
name = "test_proto",
srcs = ["test.proto"],
)
test.proto:
syntax = "proto3";
message Test {}
🔥 Exception or Error
ERROR: Traceback (most recent call last):
File "[…]/external/rules_python/python/private/proto/py_proto_library.bzl", line 20, column 38, in <toplevel>
ProtoLangToolchainInfo = proto_common.ProtoLangToolchainInfo
Error: 'proto_common' value has no field or method 'ProtoLangToolchainInfo'
🌍 Your Environment
Debian GNU/Linux
Output of bazel version:
6.0.0
Rules_python version:
0.18.1
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"
can a maintainer reopen this issue? this seems to be still valid issue. maybe @alexeagle?
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!