You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using rules python 1.0.0-rc2 in the main repository, the module extension call to initiate the pypi repo used by the protoc-gen-validate module uses the older "name" instead of using the newer "hub_name", whilst at the same time the dependency chain resolution does not initiate its own rules_python version for protoc-gen-validate.
I tried fixing it using a patch in my root module against the MODULE.bazel of protoc-gen-validate, but it did not work, most likely because protoc-gen-validate was a transitive dependency.
Output from bazel mod tidy:
bazel mod tidy
ERROR: in tag at https://bcr.bazel.build/modules/protoc-gen-validate/1.0.4/MODULE.bazel:64:10, unknown attribute name provided. Type 'bazel help mod' for syntax and help.
Version
Development (host) and target OS/architectures: linux, amd64
Output of bazel --version: bazel 7.4.1
Version of relevant rules from the WORKSPACE or MODULE.bazel file:
bazel_dep(name = "rules_python", version = "1.0.0-rc2")
bazel_dep(name = "protobuf", version = "29.0")
bazel_dep(name = "grpc", version = "1.68.0")
bazel_dep(name = "protoc-gen-validate", version = "1.0.4") // this is introduced as a dependency by grpc
Language(s) and/or frameworks involved: python, grpc, proto
How to reproduce
I tried to keep this as minimal as possible, it seems it is not triggered before you add an actual build target, so here it is:
syntax="proto3";
packagegreeter;
optiongo_package="github.com/molnett/the-bazel-pitch/protos/greeter";
// Greeter service provides simple greeting functionalityserviceGreeter {
// Greet generates a personalized greeting for the given namerpcGreet(GreetRequest) returns (GreetResponse) {}
}
// GreetRequest contains the name to be greetedmessageGreetRequest {
// Name of the person to greetstringname=1;
}
// GreetResponse contains the greeting messagemessageGreetResponse {
// The greeting messagestringmessage=1;
}
I am not entirely sure where to file this bug, if it should go against the grpc repository, as they are the ones who introduce this transitive dependency, against the rules_python repository because their version compatibility setting seems wrong (it does not resolve a separate rules_python version for the protoc-gen-validate, despite my MODULE.bazel file having 1.0.0-rc2 and them having a 0.22.0 dependency) or if I should file it here? I chose here, as I suspect that this is the place easiest to fix it however.
I did fix it for now with a multiple_versions_override like this:
This was my first thought and I tried (with 7.4.1), but it did didn't work
~ I didn't dig deep, but assumed it was because it was only a transitive
dependency and not a direct dependency.
On Mon, 2 Dec 2024, 18:43 Keith Smiley, ***@***.***> wrote:
to workaround this you can also do a patch like this:
single_version_override(
module_name = "protoc-gen-validate",
patch_strip = 1,
patches = [
# bufbuild/protoc-gen-validate#1111
"//bazel/third-party:protoc-gen-validate.patch",
],
)
diff --git a/MODULE.bazel b/MODULE.bazel
index 7a0a28c..b39f9ae 100644--- a/MODULE.bazel+++ b/MODULE.bazel@@ -62,7 +62,8 @@ use_repo(
pip = ***@***.***_python//python/extensions:pip.bzl", "pip")
pip.parse(- name = "pgv_pip_deps",+ hub_name = "pgv_pip_deps",+ python_version = "3.11",
requirements_lock = "//python:requirements.txt",
)
use_repo(pip, "pgv_pip_deps")
As long as you have i think bazel 7.4 which allows you to patch
MODULE.bazel files
—
Reply to this email directly, view it on GitHub
<#3291 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABAI6CXL7WILTWY75APNQL2DSL5BAVCNFSM6AAAAABSZPB5I6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSGI3DGNJYGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
What happened?
When using rules python 1.0.0-rc2 in the main repository, the module extension call to initiate the pypi repo used by the protoc-gen-validate module uses the older "name" instead of using the newer "hub_name", whilst at the same time the dependency chain resolution does not initiate its own rules_python version for protoc-gen-validate.
I tried fixing it using a patch in my root module against the MODULE.bazel of protoc-gen-validate, but it did not work, most likely because protoc-gen-validate was a transitive dependency.
Output from
bazel mod tidy
:Version
Development (host) and target OS/architectures: linux, amd64
Output of
bazel --version
: bazel 7.4.1Version of relevant rules from the
WORKSPACE
orMODULE.bazel
file:bazel_dep(name = "rules_python", version = "1.0.0-rc2")
bazel_dep(name = "protobuf", version = "29.0")
bazel_dep(name = "grpc", version = "1.68.0")
bazel_dep(name = "protoc-gen-validate", version = "1.0.4") // this is introduced as a dependency by grpc
Language(s) and/or frameworks involved: python, grpc, proto
How to reproduce
I tried to keep this as minimal as possible, it seems it is not triggered before you add an actual build target, so here it is:
MODULE.bazel
protos/BUILD.bazel
protos/greeter.proto
python/BUILD.bazel
python/main.py
python/requirements.txt
Any other information?
I am not entirely sure where to file this bug, if it should go against the grpc repository, as they are the ones who introduce this transitive dependency, against the rules_python repository because their version compatibility setting seems wrong (it does not resolve a separate rules_python version for the protoc-gen-validate, despite my MODULE.bazel file having 1.0.0-rc2 and them having a 0.22.0 dependency) or if I should file it here? I chose here, as I suspect that this is the place easiest to fix it however.
I did fix it for now with a multiple_versions_override like this:
The text was updated successfully, but these errors were encountered: