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

[Python] [Feature Request] Allow protobuf and grpcio dependencies to be overridden #394

Open
randymaldonado opened this issue Jan 4, 2025 · 0 comments

Comments

@randymaldonado
Copy link

Description

From the example provided, a developer will typically construct a BUILD file as follows:

load("@rules_proto_grpc_python//:defs.bzl", "python_grpc_library")

python_grpc_library(
    name = "thing_python_grpc",
    protos = ["@rules_proto_grpc_example_protos//:thing_proto"],
)

However, sometimes, a developer wants to use a specific version of protobuf or grpcio that their project is using. Their BUILD file should look like:

load("@my_projects_pip_deps//:requirements.bzl", "requirement") 
load("@rules_proto_grpc_python//:defs.bzl", "python_grpc_library")

python_grpc_library(
    name = "thing_python_grpc",
    protos = ["@rules_proto_grpc_example_protos//:thing_proto"],
    deps = [
        requirement("grpcio"),
        requirement("protobuf"),
    ],
)

This however does not work because in the current code, protobuf and grpcio python packages are hardcoded to use the versions in rules_proto_grpc_python/requirements.txt

While this one example occurs in the python_grpc_library, similar behavior occurs in python_proto_libraryand python_grpclib_library.

A simple solution might be to just check user provided deps for protobuf or grpcio and to assign a default if none were provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant