We just found out that our current Bazel setup does not support Python
3.11.
Thus PR updates some dependencies to allow using Bazel in Python 3.11.
Cython:
* Cython [backported Python 3.11 support change to
0.29x](https://github.com/cython/cython/issues/4500), but it appears
that the Cython version we are using in Bazel does not include the fix,
so we're using the latest stable version instead.
Gevent:
* The first version of gevent that supports [Python 3.11 is
22.08.0](https://github.com/gevent/gevent/issues/1903#issuecomment-1303227507).
#### Testing
* Tested locally using Python 3.11 virtual environment, was able to
reproduce the issue and verified that those changes were able to fix it.
* WIP
* Add gevent test suite run under Bazel.
* Fix things up
* Yapf
* Fix up Bazel files
* Make py_grpc_test fancier
* Attempt to fix Windows RBE
* Attempt to kick GitHub
* Fix Python 2 runs
* Yet more fixes
* And the patch file too
* I am an idiot
* Mark gevent tests flaky
* Try to make rules_python more tolerant
* Typo
* Exclude reconnect test from gevent
* Remove unnecessary parts of patch
* Buildifier
* You saw nothing
* isort
* Move py_grpc_test to an internal-only file
* Review comments
* More reviewer comments
* Review
This commit resolves an interop test currently failing on master. Over
the past couple of weeks, bazel-based tests have been introduced. The
current setup does not appear to automatically handle transitive
dependencies. Instead, transitive dependencies such as `requests` have
been manually added to `requirements.bazel.txt`. It appears that the
build server happened to have the dependencies of the `requests` library
installed already, but later had a configuration wipe.
This was compounded by the google-auth library erroneously reporting
that the `requests` module itself was not installed. In fact, it was the
transitive dependencies of `requests` that were not being installed by
the build file. (third-order dependencies of our test)
I consider this a quick fix to get the build passing. In the long run,
we need to automatically resolve and install transitive dependencies in
our bazel builds.
Resolves: #17170
Add interop tests for gRPC Python. py_proto_library rules are added to
src/proto/grpc/testing/BUILD since grpc_proto_library is not compatible
with py_* rules.
'requests' python module is added to requirements.bazel.txt as it is a
dependency for google-auth. Previously, this was installed through
tools/run_tests/helper_scripts/build_python.sh before running tests.
Add interop tests for gRPC Python. py_proto_library rules are added to
src/proto/grpc/testing/BUILD since grpc_proto_library is not compatible
with py_* rules.
'requests' python module is added to requirements.bazel.txt as it is a
dependency for google-auth. Previously, this was installed through
tools/run_tests/helper_scripts/build_python.sh before running tests.
- Include new rules from bazelbuild/rules_python, which allow for
importing pip dependencies with Bazel.
- Make Cython BUILD file visible to WORKSPACE.
- Use a custom requirements file for Bazel python. This is added to
allow for requirements previously added only during build steps.
This reorganizes the Python code, scraps the current testing
infrastructure, and implements a simple test discovery and run script
based on the standard Python unittest library so we can trust that our
tests are running.
(1) Move dependency on protobuf from grpcio to grpcio_test. While the
most-commonly-foreseen use case of grpcio makes use of protobuf,
technically protobuf is not strictly needed and there's no actual
in-code relationship between grpcio and protobuf.
(2) Loosen the dependency on protobuf from ==3.0.0a3 to >=3.0.0a3.
(3) Update all references to 0.10.0* to 0.11.0.
(4) Alphabetize the grpcio_test dependencies.
Also set up environment-related details needed for a smooth Cython
experience: have the test script avoid rebuilding all dependencies if the
virtualenv directory already exists, have the PyPI distribution script
distribute the Cython generated C code rather than the .pyx files.