grpc/test/distrib/bazel/python
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
..
in_subpackage Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
namespaced/upper/example [Python] Migrate from yapf to black (#33138) 2023-06-09 15:08:55 -07:00
subdir Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
tools Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
.bazelrc Update Abseil to 20230125 (#32139) 2023-01-30 16:20:24 -08:00
.gitignore Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
BUILD [bazel] Auto-generate .pyi files in py_proto_library rule (#32872) 2023-06-12 14:36:24 -07:00
README.md Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
WORKSPACE [bazel] Auto-generate .pyi files in py_proto_library rule (#32872) 2023-06-12 14:36:24 -07:00
helloworld.proto Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
helloworld.py [Python] Migrate from yapf to black (#33138) 2023-06-09 15:08:55 -07:00
helloworld_moved.py [Python] Migrate from yapf to black (#33138) 2023-06-09 15:08:55 -07:00
import_from_proto_library_package.py Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
import_from_this_package.py Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00
python_rules_test.bzl [bazel] Auto-generate .pyi files in py_proto_library rule (#32872) 2023-06-12 14:36:24 -07:00
transitive_proto_dep.py Rehome python bazel distribtest (#29275) 2022-04-01 15:04:50 -07:00

README.md

Bazel Workspace Test

This directory houses a test ensuring that downstream projects can use @com_github_grpc_grpc//src/python/grpcio:grpcio, py_proto_library, and py_grpc_library.