grpc/bazel
Florian Ferstl fa32eb36b3
[bazel] Auto-generate .pyi files in py_proto_library rule (#32872)
With some delay, this is a PR for
https://github.com/grpc/grpc/issues/32564 (and previously
https://github.com/grpc/grpc/pull/31791).

I looked into adding a regular `py_test` for this change [as
suggested](https://github.com/grpc/grpc/pull/31791#issuecomment-1423245116)
but I am not aware of any effect that the presence of a .pyi stub file
would have at runtime and where some sort of type-checking in a .py
script would be affected. Stub files are only for use by type checkers &
IDE's. I mean, something like this would work:

```
import helloworld_pb2
py_file = helloworld_pb2.__file__ 
pyi_file = py_file + 'i’
self.assertTrue(os.path.exists(pyi_file))
```

But that seems really hacky to me. Instead I created a simple rule test
for `py_proto_library` with Bazel Skylib which tests the declared
outputs for an example `py_proto_library` target. Indirectly, this also
tests that the declared output files are actually generated. Please let
me know if this is sufficient.
2023-06-12 14:36:24 -07:00
..
BUILD Make Buildifier Sanity Test Strict (#27807) 2021-11-03 14:57:04 -07:00
OWNERS bG6b3V2MNxQ (#30021) 2022-06-21 08:00:32 -07:00
_gevent_test_main.py Revert "Revert "Reimplement Gevent Integration (#28276)" (#28862)" (#28863) 2022-02-11 13:43:01 -08:00
cc_grpc_library.bzl [reland][fuzzing] Client channel resolver fuzzer (#33153) 2023-05-16 17:32:29 -07:00
copts.bzl [build] Enable -Wunused-but-set-variable (#32439) 2023-02-21 13:28:47 -08:00
custom_exec_properties.bzl Make Buildifier Sanity Test Strict (#27807) 2021-11-03 14:57:04 -07:00
cython_library.bzl [EventEngine] Disable EventEngine polling in gRPC Python (#33279) 2023-05-30 19:26:44 -07:00
experiments.bzl [EventEngine] Return work stealing experiment to CI-only (#33389) 2023-06-09 12:37:20 -07:00
generate_cc.bzl Remove returning struct in cc_grpc_library (#32360) 2023-02-14 20:53:53 -08:00
generate_objc.bzl Update third_party/protobuf to 3.21.4 (#30377) 2022-08-04 09:39:49 -07:00
gevent_test.bzl [Python fix-it][Gevent] Enable gevent _dynamic_stubs_test (#32842) 2023-04-12 14:03:31 -07:00
grpc_build_system.bzl [ios] damage control (#33391) 2023-06-09 12:37:34 -07:00
grpc_deps.bzl [bazel] Auto-generate .pyi files in py_proto_library rule (#32872) 2023-06-12 14:36:24 -07:00
grpc_extra_deps.bzl [xDS Proto] Update Bazel build dependencies for Envoy API (#29219) 2022-03-29 11:18:39 -07:00
grpc_python_deps.bzl [Bazel Python3.11] Update Bazel dependencies for Python 3.11 (#33318) 2023-06-01 15:32:16 -07:00
grpc_util.bzl Make Buildifier Sanity Test Strict (#27807) 2021-11-03 14:57:04 -07:00
internal_python_rules.bzl Remove Python2 from python_configure.bzl (#28406) 2021-12-28 10:16:14 -08:00
objc_grpc_library.bzl Make Buildifier Sanity Test Strict (#27807) 2021-11-03 14:57:04 -07:00
protobuf.bzl [Release] Upmerge v1.55.x branch into master (#33277) 2023-05-30 14:45:06 -07:00
python_rules.bzl [bazel] Auto-generate .pyi files in py_proto_library rule (#32872) 2023-06-12 14:36:24 -07:00
supported_versions.txt [Infra] Use Bazel 6 and drop Bazel 4 (Part 2) (#32910) 2023-04-21 15:53:52 -07:00
update_mirror.sh [Infra] Use Bazel 6 and drop Bazel 4 (Part 2) (#32910) 2023-04-21 15:53:52 -07:00