1workspace(name = "rules_python_py_proto_library_example") 2 3# The following local_path_override is only needed to run this example as part of our CI. 4local_repository( 5 name = "rules_python", 6 path = "../..", 7) 8 9# When not using this example in the rules_python git repo you would load the python 10# rules using http_archive(), as documented in the release notes. 11 12load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") 13 14# We install the rules_python dependencies using the function below. 15py_repositories() 16 17python_register_toolchains( 18 name = "python39", 19 python_version = "3.9", 20) 21 22# Then we need to setup dependencies in order to use py_proto_library 23load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 24 25http_archive( 26 name = "rules_proto", 27 sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", 28 strip_prefix = "rules_proto-5.3.0-21.7", 29 urls = [ 30 "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", 31 ], 32) 33 34http_archive( 35 name = "com_google_protobuf", 36 sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", 37 strip_prefix = "protobuf-21.7", 38 urls = [ 39 "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", 40 "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", 41 ], 42) 43 44load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") 45 46rules_proto_dependencies() 47 48rules_proto_toolchains() 49