pw_protobuf_compiler: Protobuf type annotations
- Use the mypy-protobufs protoc plugin to generate type annotations for
Python protobufs.
- Update Python proto package generation to include py.typed files.
Change-Id: I75e658d38b56853135005af6f35624de5df93a7e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/28960
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
diff --git a/pw_protobuf_compiler/BUILD.gn b/pw_protobuf_compiler/BUILD.gn
index 58dce83..0d678a0 100644
--- a/pw_protobuf_compiler/BUILD.gn
+++ b/pw_protobuf_compiler/BUILD.gn
@@ -14,7 +14,7 @@
import("//build_overrides/pigweed.gni")
-import("$dir_pw_build/input_group.gni")
+import("$dir_pw_build/python.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_protobuf_compiler/proto.gni")
import("$dir_pw_unit_test/test.gni")
@@ -34,5 +34,17 @@
}
pw_proto_library("nanopb_test_protos") {
- sources = [ "pw_protobuf_compiler_protos/nanopb_test.proto" ]
+ sources = [ "pw_protobuf_compiler_nanopb_protos/nanopb_test.proto" ]
+}
+
+pw_proto_library("test_protos") {
+ sources = [
+ "pw_protobuf_compiler_protos/nested/more_nesting/test.proto",
+ "pw_protobuf_compiler_protos/test.proto",
+ ]
+}
+
+# PyPI Requirements needed to install Python protobuf packages.
+pw_python_requirements("protobuf_requirements") {
+ requirements = [ "mypy-protobuf" ]
}