Skip to content
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

Confusing error message if rules_proto isn't loaded #1080

Closed
phst opened this issue Feb 20, 2023 · 4 comments · Fixed by #1933
Closed

Confusing error message if rules_proto isn't loaded #1080

phst opened this issue Feb 20, 2023 · 4 comments · Fixed by #1933
Labels
Can Close? Will close in 30 days if there is no new activity

Comments

@phst
Copy link
Contributor

phst commented Feb 20, 2023

🐞 bug report

Affected Rule

The issue is caused by the rule: py_proto_library

Is this a regression?

No

Description

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

@github-actions
Copy link

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!

@github-actions github-actions bot added the Can Close? Will close in 30 days if there is no new activity label Aug 19, 2023
@github-actions
Copy link

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

@thesayyn
Copy link
Contributor

thesayyn commented Nov 8, 2023

can a maintainer reopen this issue? this seems to be still valid issue. maybe @alexeagle?

@rickeylev rickeylev reopened this Nov 8, 2023
@github-actions github-actions bot removed the Can Close? Will close in 30 days if there is no new activity label Nov 8, 2023
Copy link

github-actions bot commented May 6, 2024

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!

@github-actions github-actions bot added the Can Close? Will close in 30 days if there is no new activity label May 6, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 5, 2024
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.

Expected side effect of this change is also that the protobuf version is
sufficiently updated that there is no more use of legacy struct
providers.

Closes #1935 
Closes #1924 
Closes #1925 
Closes #1703 
Closes #1707 
Closes #1597 
Closes #1293 
Closes #1080
Fixes #1438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? Will close in 30 days if there is no new activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants