From f86846469f2d120a74532d32606f423b713ed851 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Fri, 8 Sep 2023 11:41:19 -0700 Subject: [PATCH 1/8] allowing to import code generated from proto --- python/private/proto/py_proto_library.bzl | 9 ++++----- tests/py_proto_library/proto/BUILD.bazel | 21 +++++++++++++++++++++ tests/py_proto_library/proto/one.proto | 14 ++++++++++++++ tests/py_proto_library/proto/two.proto | 3 +++ tests/py_proto_library/py/BUILD.bazel | 7 +++++++ tests/py_proto_library/py/test_proto.py | 8 ++++++++ 6 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 tests/py_proto_library/proto/BUILD.bazel create mode 100644 tests/py_proto_library/proto/one.proto create mode 100644 tests/py_proto_library/proto/two.proto create mode 100644 tests/py_proto_library/py/BUILD.bazel create mode 100644 tests/py_proto_library/py/test_proto.py diff --git a/python/private/proto/py_proto_library.bzl b/python/private/proto/py_proto_library.bzl index 9377c8513c..6f09fb9af8 100644 --- a/python/private/proto/py_proto_library.bzl +++ b/python/private/proto/py_proto_library.bzl @@ -78,12 +78,10 @@ def _py_proto_aspect_impl(target, ctx): # Handles multiple repository and virtual import cases proto_root = proto_info.proto_source_root if proto_root.startswith(ctx.bin_dir.path): - plugin_output = proto_root - else: - plugin_output = ctx.bin_dir.path + "/" + proto_root + proto_root = proto_root[len(ctx.bin_dir.path) + 1:] - if plugin_output == ".": - plugin_output = ctx.bin_dir.path + plugin_output = ctx.bin_dir.path + "/" + proto_root + proto_root = ctx.workspace_name + "/" + proto_root proto_common.compile( actions = ctx.actions, @@ -109,6 +107,7 @@ def _py_proto_aspect_impl(target, ctx): return [ _PyProtoInfo( imports = depset( + [proto_root], transitive = [dep[PyInfo].imports for dep in api_deps], ), runfiles_from_proto_deps = runfiles_from_proto_deps, diff --git a/tests/py_proto_library/proto/BUILD.bazel b/tests/py_proto_library/proto/BUILD.bazel new file mode 100644 index 0000000000..1dfd3b074a --- /dev/null +++ b/tests/py_proto_library/proto/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") +load("//python:proto.bzl", "py_proto_library") + +proto_library( + name = "proto", + srcs = [ + "one.proto", + "two.proto", + ], + strip_import_prefix = "/tests/py_proto_library", + visibility = ["//visibility:public"], + deps = [ + "@com_google_protobuf//:timestamp_proto", + ], +) + +py_proto_library( + name = "py_proto", + deps = [":proto"], + visibility = ["//visibility:public"], +) diff --git a/tests/py_proto_library/proto/one.proto b/tests/py_proto_library/proto/one.proto new file mode 100644 index 0000000000..2dc34e668f --- /dev/null +++ b/tests/py_proto_library/proto/one.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package proto; + +import "google/protobuf/timestamp.proto"; +import "proto/two.proto"; + +message LogEntry { + // Time the call started. + google.protobuf.Timestamp start_time = 1; + + // Time the call closed. + google.protobuf.Timestamp end_time = 2; +} diff --git a/tests/py_proto_library/proto/two.proto b/tests/py_proto_library/proto/two.proto new file mode 100644 index 0000000000..bd4d2f34e3 --- /dev/null +++ b/tests/py_proto_library/proto/two.proto @@ -0,0 +1,3 @@ +syntax = "proto3"; + +package proto; diff --git a/tests/py_proto_library/py/BUILD.bazel b/tests/py_proto_library/py/BUILD.bazel new file mode 100644 index 0000000000..6f33f37eca --- /dev/null +++ b/tests/py_proto_library/py/BUILD.bazel @@ -0,0 +1,7 @@ +load("@rules_python//python:defs.bzl", "py_test") + +py_test( + name = "test_proto", + srcs = ["test_proto.py"], + deps = ["//tests/py_proto_library/proto:py_proto"], +) \ No newline at end of file diff --git a/tests/py_proto_library/py/test_proto.py b/tests/py_proto_library/py/test_proto.py new file mode 100644 index 0000000000..f891fc751f --- /dev/null +++ b/tests/py_proto_library/py/test_proto.py @@ -0,0 +1,8 @@ +import unittest + +class TestProto(unittest.TestCase): + def test_import_one(self): + from proto.one_pb2 import DESCRIPTOR + +if __name__ == "__main__": + unittest.main() \ No newline at end of file From a6bbc28f4e00cd0d45273225a1ef66446114c4f1 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Fri, 8 Sep 2023 13:10:01 -0700 Subject: [PATCH 2/8] buildifier --- tests/py_proto_library/proto/BUILD.bazel | 2 +- tests/py_proto_library/py/BUILD.bazel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/py_proto_library/proto/BUILD.bazel b/tests/py_proto_library/proto/BUILD.bazel index 1dfd3b074a..79e3c24343 100644 --- a/tests/py_proto_library/proto/BUILD.bazel +++ b/tests/py_proto_library/proto/BUILD.bazel @@ -16,6 +16,6 @@ proto_library( py_proto_library( name = "py_proto", - deps = [":proto"], visibility = ["//visibility:public"], + deps = [":proto"], ) diff --git a/tests/py_proto_library/py/BUILD.bazel b/tests/py_proto_library/py/BUILD.bazel index 6f33f37eca..4b16d3c441 100644 --- a/tests/py_proto_library/py/BUILD.bazel +++ b/tests/py_proto_library/py/BUILD.bazel @@ -4,4 +4,4 @@ py_test( name = "test_proto", srcs = ["test_proto.py"], deps = ["//tests/py_proto_library/proto:py_proto"], -) \ No newline at end of file +) From 1499704e1fe6c121210a1ce812aea5d76736ee9f Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Thu, 14 Sep 2023 21:48:13 -0700 Subject: [PATCH 3/8] reuse examples --- examples/py_proto_library/.bazelrc | 1 + examples/py_proto_library/BUILD.bazel | 14 +------------ .../example.com/proto/BUILD.bazel | 14 +++++++++++++ .../{ => example.com/proto}/pricetag.proto | 0 examples/py_proto_library/test.py | 2 +- tests/py_proto_library/proto/BUILD.bazel | 21 ------------------- tests/py_proto_library/proto/one.proto | 14 ------------- tests/py_proto_library/proto/two.proto | 3 --- tests/py_proto_library/py/BUILD.bazel | 7 ------- tests/py_proto_library/py/test_proto.py | 8 ------- 10 files changed, 17 insertions(+), 67 deletions(-) create mode 100644 examples/py_proto_library/example.com/proto/BUILD.bazel rename examples/py_proto_library/{ => example.com/proto}/pricetag.proto (100%) delete mode 100644 tests/py_proto_library/proto/BUILD.bazel delete mode 100644 tests/py_proto_library/proto/one.proto delete mode 100644 tests/py_proto_library/proto/two.proto delete mode 100644 tests/py_proto_library/py/BUILD.bazel delete mode 100644 tests/py_proto_library/py/test_proto.py diff --git a/examples/py_proto_library/.bazelrc b/examples/py_proto_library/.bazelrc index e69de29bb2..e3d8eac8f4 100644 --- a/examples/py_proto_library/.bazelrc +++ b/examples/py_proto_library/.bazelrc @@ -0,0 +1 @@ +test --test_output errors \ No newline at end of file diff --git a/examples/py_proto_library/BUILD.bazel b/examples/py_proto_library/BUILD.bazel index 7a18a5e4e1..f9ec69d2fd 100644 --- a/examples/py_proto_library/BUILD.bazel +++ b/examples/py_proto_library/BUILD.bazel @@ -1,22 +1,10 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") load("@rules_python//python:defs.bzl", "py_test") -load("@rules_python//python:proto.bzl", "py_proto_library") - -py_proto_library( - name = "pricetag_proto_py_pb2", - deps = [":pricetag_proto"], -) - -proto_library( - name = "pricetag_proto", - srcs = ["pricetag.proto"], -) py_test( name = "pricetag_test", srcs = ["test.py"], main = "test.py", deps = [ - ":pricetag_proto_py_pb2", + "//example.com/proto:pricetag_proto_py_pb2", ], ) diff --git a/examples/py_proto_library/example.com/proto/BUILD.bazel b/examples/py_proto_library/example.com/proto/BUILD.bazel new file mode 100644 index 0000000000..800beb8576 --- /dev/null +++ b/examples/py_proto_library/example.com/proto/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@rules_python//python:proto.bzl", "py_proto_library") + +py_proto_library( + name = "pricetag_proto_py_pb2", + visibility = ["//visibility:public"], + deps = [":pricetag_proto"], +) + +proto_library( + name = "pricetag_proto", + srcs = ["pricetag.proto"], + strip_import_prefix = "/example.com", +) diff --git a/examples/py_proto_library/pricetag.proto b/examples/py_proto_library/example.com/proto/pricetag.proto similarity index 100% rename from examples/py_proto_library/pricetag.proto rename to examples/py_proto_library/example.com/proto/pricetag.proto diff --git a/examples/py_proto_library/test.py b/examples/py_proto_library/test.py index 9f09702f8c..ec24600740 100644 --- a/examples/py_proto_library/test.py +++ b/examples/py_proto_library/test.py @@ -1,7 +1,7 @@ import sys import unittest -import pricetag_pb2 +from proto import pricetag_pb2 class TestCase(unittest.TestCase): diff --git a/tests/py_proto_library/proto/BUILD.bazel b/tests/py_proto_library/proto/BUILD.bazel deleted file mode 100644 index 79e3c24343..0000000000 --- a/tests/py_proto_library/proto/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("//python:proto.bzl", "py_proto_library") - -proto_library( - name = "proto", - srcs = [ - "one.proto", - "two.proto", - ], - strip_import_prefix = "/tests/py_proto_library", - visibility = ["//visibility:public"], - deps = [ - "@com_google_protobuf//:timestamp_proto", - ], -) - -py_proto_library( - name = "py_proto", - visibility = ["//visibility:public"], - deps = [":proto"], -) diff --git a/tests/py_proto_library/proto/one.proto b/tests/py_proto_library/proto/one.proto deleted file mode 100644 index 2dc34e668f..0000000000 --- a/tests/py_proto_library/proto/one.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; - -package proto; - -import "google/protobuf/timestamp.proto"; -import "proto/two.proto"; - -message LogEntry { - // Time the call started. - google.protobuf.Timestamp start_time = 1; - - // Time the call closed. - google.protobuf.Timestamp end_time = 2; -} diff --git a/tests/py_proto_library/proto/two.proto b/tests/py_proto_library/proto/two.proto deleted file mode 100644 index bd4d2f34e3..0000000000 --- a/tests/py_proto_library/proto/two.proto +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; - -package proto; diff --git a/tests/py_proto_library/py/BUILD.bazel b/tests/py_proto_library/py/BUILD.bazel deleted file mode 100644 index 4b16d3c441..0000000000 --- a/tests/py_proto_library/py/BUILD.bazel +++ /dev/null @@ -1,7 +0,0 @@ -load("@rules_python//python:defs.bzl", "py_test") - -py_test( - name = "test_proto", - srcs = ["test_proto.py"], - deps = ["//tests/py_proto_library/proto:py_proto"], -) diff --git a/tests/py_proto_library/py/test_proto.py b/tests/py_proto_library/py/test_proto.py deleted file mode 100644 index f891fc751f..0000000000 --- a/tests/py_proto_library/py/test_proto.py +++ /dev/null @@ -1,8 +0,0 @@ -import unittest - -class TestProto(unittest.TestCase): - def test_import_one(self): - from proto.one_pb2 import DESCRIPTOR - -if __name__ == "__main__": - unittest.main() \ No newline at end of file From a573d8a48fbc8a17e6c4ce05b71eab7246dc69a6 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Fri, 15 Sep 2023 07:55:23 -0700 Subject: [PATCH 4/8] exclude examples from tests, buildifier --- .bazelci/presubmit.yml | 2 ++ python/private/proto/py_proto_library.bzl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1da4d9fb6b..e14d56a4a4 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -28,6 +28,8 @@ buildifier: build_targets: - "--" - "..." + # This has its own workspace and needs to run from there + - "-//examples/py_proto_library/..." # As a regression test for #225, check that wheel targets still build when # their package path is qualified with the repo name. - "@rules_python//examples/wheel/..." diff --git a/python/private/proto/py_proto_library.bzl b/python/private/proto/py_proto_library.bzl index 6f09fb9af8..226da6c0aa 100644 --- a/python/private/proto/py_proto_library.bzl +++ b/python/private/proto/py_proto_library.bzl @@ -66,6 +66,7 @@ def _py_proto_aspect_impl(target, ctx): generated_sources = [] proto_info = target[ProtoInfo] + proto_root = proto_info.proto_source_root if proto_info.direct_sources: # Generate py files generated_sources = proto_common.declare_generated_files( @@ -76,7 +77,6 @@ def _py_proto_aspect_impl(target, ctx): ) # Handles multiple repository and virtual import cases - proto_root = proto_info.proto_source_root if proto_root.startswith(ctx.bin_dir.path): proto_root = proto_root[len(ctx.bin_dir.path) + 1:] From fbd9ba9c040d5b7acaf3bb1c61c9319c4599eee1 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Sat, 23 Sep 2023 19:17:26 -0700 Subject: [PATCH 5/8] comments --- .bazelrc | 2 -- examples/py_proto_library/example.com/proto/BUILD.bazel | 1 + python/private/proto/py_proto_library.bzl | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index 39b28d12e6..67a223f8e5 100644 --- a/.bazelrc +++ b/.bazelrc @@ -6,8 +6,6 @@ build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points -test --test_output=errors - # Do NOT implicitly create empty __init__.py files in the runfiles tree. # By default, these are created in every directory containing Python source code # or shared libraries, and every parent directory of those directories, diff --git a/examples/py_proto_library/example.com/proto/BUILD.bazel b/examples/py_proto_library/example.com/proto/BUILD.bazel index 800beb8576..917d023abd 100644 --- a/examples/py_proto_library/example.com/proto/BUILD.bazel +++ b/examples/py_proto_library/example.com/proto/BUILD.bazel @@ -10,5 +10,6 @@ py_proto_library( proto_library( name = "pricetag_proto", srcs = ["pricetag.proto"], + # https://bazel.build/reference/be/protocol-buffer#proto_library.strip_import_prefix strip_import_prefix = "/example.com", ) diff --git a/python/private/proto/py_proto_library.bzl b/python/private/proto/py_proto_library.bzl index 226da6c0aa..116590f1a3 100644 --- a/python/private/proto/py_proto_library.bzl +++ b/python/private/proto/py_proto_library.bzl @@ -107,6 +107,9 @@ def _py_proto_aspect_impl(target, ctx): return [ _PyProtoInfo( imports = depset( + # Adding to PYTHONPATH so the generated modules can be imported. + # This is necessary when there is strip_import_prefix, the Python + # modules are generated under _virtual_imports. [proto_root], transitive = [dep[PyInfo].imports for dep in api_deps], ), From 6a3714cd46ae9b1be2c7cadaf6c8a82de5c2d412 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Sat, 23 Sep 2023 19:18:24 -0700 Subject: [PATCH 6/8] adding test_output back --- .bazelrc | 2 ++ examples/py_proto_library/.bazelrc | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 67a223f8e5..39b28d12e6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -6,6 +6,8 @@ build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points +test --test_output=errors + # Do NOT implicitly create empty __init__.py files in the runfiles tree. # By default, these are created in every directory containing Python source code # or shared libraries, and every parent directory of those directories, diff --git a/examples/py_proto_library/.bazelrc b/examples/py_proto_library/.bazelrc index e3d8eac8f4..e69de29bb2 100644 --- a/examples/py_proto_library/.bazelrc +++ b/examples/py_proto_library/.bazelrc @@ -1 +0,0 @@ -test --test_output errors \ No newline at end of file From e5c34c6830b6cbe7898a3f876e87f39fa154588d Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Mon, 25 Sep 2023 23:56:45 +0900 Subject: [PATCH 7/8] run: 'pre-commit run update-deleted-packages -a' --- .bazelci/presubmit.yml | 2 -- .bazelrc | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index e14d56a4a4..1da4d9fb6b 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -28,8 +28,6 @@ buildifier: build_targets: - "--" - "..." - # This has its own workspace and needs to run from there - - "-//examples/py_proto_library/..." # As a regression test for #225, check that wheel targets still build when # their package path is qualified with the repo name. - "@rules_python//examples/wheel/..." diff --git a/.bazelrc b/.bazelrc index 39b28d12e6..32e86e5859 100644 --- a/.bazelrc +++ b/.bazelrc @@ -3,8 +3,8 @@ # This lets us glob() up all the files inside the examples to make them inputs to tests # (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it) # To update these lines, run tools/bazel_integration_test/update_deleted_packages.sh -build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points -query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points +build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/proto,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points +query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/proto,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points test --test_output=errors From 6f08c9ed4187e4d53537bfb291d1312fb32e50db Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Tue, 10 Oct 2023 18:47:19 -0700 Subject: [PATCH 8/8] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1675c5bcf3..bf09665ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ A brief description of the categories of changes: * Skip aliases for unloaded toolchains. Some Python versions that don't have full platform support, and referencing their undefined repositories can break operations like `bazel query rdeps(...)`. +* Python code generated from `proto_library` with `strip_import_prefix` can be imported now. ## [0.26.0] - 2023-10-06