Commit Graph

81 Commits

Author SHA1 Message Date
Xuan Wang ce220f01a5 [Python Test] Remove googleapis-common-protos from build_python (#36874)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36874

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36874 from XuanWang-Amos:remove_common_proto_dep 51400c5aff
PiperOrigin-RevId: 642424550
2024-06-11 16:09:50 -07:00
Esun Kim 6814867e78 [CI] Updated clang docker images to use Debian 12 (#36810)
All clang docker images here are based on Debian 11 (Bullseye) but now we're moving to Debian 12 (Bookworm) primarily to use the recent versions of Cmake >= 3.20 to use CXX_STANDARD=23 for some tests ([doc](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html))

Closes #36810

PiperOrigin-RevId: 640688681
2024-06-05 16:38:08 -07:00
Xuan Wang f3220d08d2 [Python O11y] Implement CSM observability for Python (#36557)
Implement Python CSM observability.

Design: [go/grpc-python-opentelemetry](http://goto.google.com/grpc-python-opentelemetry)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36557

PiperOrigin-RevId: 639073741
2024-05-31 10:17:57 -07:00
Xuan Wang 9aa3c5835a [Python O11y] Remove exporter from public API and refactor tests (#35792)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #35792

PiperOrigin-RevId: 604695910
2024-02-06 10:48:40 -08:00
Richard Belleville 7e7b4fd1a4 Fix breakage when built against protobuf head (#34945)
This PR is required in order to upgrade to the `master` branch version of protobuf. To do this, we upgrade to the latest version of `rules_python` by:

- Adding in explicit dependencies on all PyPi Bazel test dependencies
  - Resolving the circular dependency this creates for `xds-protos` by giving it a Bazel build
    - Generating the Python code for `xds-protos` as part of `generate-projects.sh` since doing so directly in Bazel would be highly fragily, dependent on many other projects' Bazel builds

Closes #34945

PiperOrigin-RevId: 599875020
2024-01-19 12:43:14 -08:00
Xuan Wang 47aa2fc59b [Fix test] Fix ensurepip missing (#35437)
Passed manual runs:
* [grpc/core/master/linux/grpc_interop_tocloud](https://fusion2.corp.google.com/invocations/70b9a382-03b0-46ce-9181-cd3382ae9ee7) (Ruby failed)
* [grpc/core/master/linux/arm64/grpc_basictests_python](https://fusion2.corp.google.com/invocations/279d959a-3d3f-4d0c-a0a3-712fefca14fe/targets)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #35437

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35437 from XuanWang-Amos:fix_ensurepip_missing 8c572dcfa5
PiperOrigin-RevId: 595520790
2024-01-03 15:37:38 -08:00
Xuan Wang 2d7b751d4e [Python run_test] Support Python3.12 (#35325)
Fix: https://github.com/grpc/grpc/issues/35085
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #35325

PiperOrigin-RevId: 592635611
2023-12-20 12:59:24 -08:00
Xuan Wang 7f2ecdb3f8 [Python Observability] Building package and add to run_test (#34207)
### Changes in this PR
* Refactor and remove some Core/C++ dependencies to simplify Python Observability package build process.
* Refactored code to read config at Python layer.
* Enable observability build from source.
* Add observability to run_test.
  * Currently it's only enabled in Linux.
* Add error handler in run_test loaders.
  * Current framework will always visit modules in test directory then decide which tests to skip.
  * Since we're not building Observability for MacOS and Windows this step will fail with error `No module named 'grpc_observability'`.
  * After the change we'll just skip those modules.
    * We still have `_sanity_test` to make sure all tests are loaded correctly for each platform.
* Remov OC dependency as we're migrating to OTel.
  * Also removed trace from testing.
  * Note that trace propagation function was also removed because of this.

### Testing
* Passed existing tests.
* Tested locally, able to build observability from source using `GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .`.

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #34207

PiperOrigin-RevId: 590258014
2023-12-12 10:51:35 -08:00
Xuan Wang 43661ab364
[Python run_test] Revert "Revert "[Python run_test] Fix run_test"" (#34671)
Reverts grpc/grpc#34667

The change was reverted because it failed to import to g3, after some
changes, now it's safe to reapply those changes.

Tested by importing this PR internally, it passed presubmit:
cl/573836270
2023-10-19 09:47:17 -07:00
Craig Tiller 0496589405
Revert "[Python run_test] Fix run_test" (#34667)
Reverts grpc/grpc#34292
2023-10-11 17:46:20 -07:00
Xuan Wang 11d9b083f3
[Python run_test] Fix run_test (#34292)
We're not running any test at all from `run_test.py` because of the way
we filter test cases:

1d136fd05f/src/python/grpcio_tests/tests/_runner.py (L137)

* `testcase_filter` is read from a json file (like [this
one](https://github.com/grpc/grpc/blob/master/src/python/grpcio_tests/tests/tests.json))
and test name is similar to `unit._metadata_test.MetadataTest`.
* `case.id()` is loaded by `iterate_suite_cases` and will always have a
prefix of `tests`, an example of case id will be:
`tests.unit._metadata_test.MetadataTest`.

Because of the prefix, none of the test case will be matched thus we're
not running any of the tests.

This PR fixes the prefix issue and all the regressions comes from not
running tests using `run_test.py`.

#### Other Changes
* Added couple of `__init__.py` file since it's required to load tests.
* Added `py_status_code` to Aio rpc state.
* `code()` is expecting to return a python gRPC code but current
`status_code` is a Cython code.
* Added `libsqlite3-dev` to our dockers because it's required for
`coverage==7.2.0`.
* Renamed csds and admin test because test case file have to end with
`_test`:
1d136fd05f/src/python/grpcio_tests/tests/_loader.py (L26)
* Removed gevent test from `run_test.py` because Bazel gevent tests
should be good enough for us.

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-10-11 09:50:53 -07:00
Xuan Wang c7a1336566
[Python 3.12] Deprecate distutil (#34186)
### Background

* `distutils` is deprecated with removal planned for Python 3.12
([pep-0632](https://peps.python.org/pep-0632/)), thus we're trying to
replace all distutils usage with setuptools.
* Please note that user still have access to `distutils` if setuptools
is installed and `SETUPTOOLS_USE_DISTUTILS` is set to `local` (The
default in setuptools, more details can be found [in this
discussion](https://github.com/pypa/setuptools/issues/2806#issuecomment-1193336591)).

### How we decide the replacement

* We're following setuptools [Porting from Distutils
guide](https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html#porting-from-distutils)
when deciding the replacement.

#### Replacement not mentioned in the guide

* Replaced `distutils.utils.get_platform()` with
`sysconfig.get_platform()`.
* Based on the [answer
here](https://stackoverflow.com/questions/71664875/what-is-the-replacement-for-distutils-util-get-platform),
and also checked the document that `sysconfig.get_platform()` is good
enough for our use cases.
* Replaced `DistutilsOptionError` with `OptionError`.
* `setuptools.error` is exporting it as `OptionError` [in the
code](https://github.com/pypa/setuptools/blob/v59.6.0/setuptools/errors.py).
* Upgrade `setuptools` in `test_packages.sh` and changed the version
ping to `59.6.0` in `build_artifact_python.bat`.
* `distutils.errors.*` is not fully re-exported until `59.0.0` (See
[this issue](https://github.com/pypa/setuptools/issues/2698) for more
details).

### Changes not included in this PR

* We're patching some compiler related functions provided by distutils
in our code
([example](ee4efc31c1/src/python/grpcio/_spawn_patch.py (L30))),
but since `setuptools` doesn't have similar interface (See [this issue
for more details](https://github.com/pypa/setuptools/issues/2806)), we
don't have a clear path to replace them yet.


<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-09-06 14:32:30 -07:00
Richard Belleville 498fc99479
[packaging] Publish xds-protos as part of the standard package pipeline (#33797)
This PR:

- Fixes the xds-protos Python package, which was broken when the `udpa`
submodule was removed
  - This required re-adding the protoc-gen-validate submodule
- Adds non-Bazel tests for xds-protos and all of its dependent packages
- Versions xds-protos the same way as the rest of the Python packages
- Fixes Python 3.11 support in `run_tests.py`, which is necessary for
the testing mentioned above


CC @sergiitk You won't be able to consume this in the interop tests
until it makes it into a release. I'm thinking I'll want to backport
this to the 1.57.x branch to make that happen faster.

CC @drfloob to inform him about the likely backport.
2023-07-25 16:41:02 -07:00
Vignesh Babu 087b74f739
Revert "Revert "[interop] Add absl dependency to interop server"" #33828 (#33830)
Reverts https://github.com/grpc/grpc/pull/33676

The serve method needs to be called with args. The previous attempt did
not change the signature in commands.py which lead to errors such as
https://screenshot.googleplex.com/6wZVER9ZETMGAmA.

The fix is in
4e211d0291
2023-07-24 12:02:02 -07:00
Richard Belleville d714ae72e7
[dependency] Restrict cython to less than 3.X (#33738)
This should resolve breakage on master caused by the jump to Cython
3.0.0 this morning.
2023-07-18 12:56:16 -07:00
Vignesh Babu c9eeca9681
Revert "[interop] Add absl dependency to interop server" (#33676)
Reverts grpc/grpc#33647
2023-07-12 16:21:46 -07:00
Vignesh Babu fa95c4c439
[interop] Add absl dependency to interop server (#33647)
<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-07-11 15:02:17 -07:00
Richard Belleville e41e41e209
Remove protobuf 4.22.0 from testing (#32442)
This version broke backward compatibility in `plugin_pb2.py`, which is
presumably a relatively minor regression, since we have not yet heard
any complaints about it. This PR:

- Excludes `4.22.0` from installation
- _Includes_ protobuf pre-releases into testing so this can be caught
more quickly in the future.

When bad prereleases are caught, we can exclude them from testing in a
similar manner to this PR. We may eventually want to invest into a
system where we can define these bad versions centrally.
2023-02-22 09:40:48 -08:00
Jan Tattermusch 108444e9f7
Fix python tests on kokoro macos monterey (#31126)
* fix python build on kokoro macos monterey

* avoid using realpath

* fix grpc_distribtests_python on macos monterey

* try upgrade setuptools
2022-10-10 17:45:31 +02:00
Yash Tibrewal 41ec08c69a
Update third_party/protobuf to 3.21.4 (#30377)
* Update third_party/protobuf

* run tools/distrib/python/make_grpcio_tools.py

* regenerate protos for ruby, php

* update build_handwritten.yaml

* regenerate projects

* Build - Use :well_known_type_protos instead of :well_known_protos

* Fix target

* Update upb

* Update Python for Protobuf 4.21 (#140)

* Update protobuf dependency on grpcio-tools

* Off by one

* Drop python 3.6 support

* Try upgrading pip

* And in the other script

* Try to figure out if we're compatible with abi3

* See what we've already got installed

* Update the requirements.txt file I didn't know existed

* And here too

* See what's installed

* Let's try that again

* Remove

* Try to confirm version

* Let me see the generated code

* Fix non-Bazel test runner

* Work for all test directories

* Regenerate example protos

* Clean up

* Generate .pyi files

* Fix type checking and linting

* Exclude pyi files from isort

* Upgrade to 3.21.4

* Update iwyu to get around messy protobuf IWYU rules

Co-authored-by: Richard Belleville <gnossen@gmail.com>
2022-08-04 09:39:49 -07:00
Richard Belleville dec31be045
Fix Race Condition During grpcio-tests Install on CI (#30093)
* Tryonly running fetch_build_eggs once

* Run pip freeze

* Use the correct pip

* Try explicitly printing stacktrace

* Try to pin/upgrade the wheel package

* Try running only 3.8

* Show the initial state of the egg directory

* Whoops

* More permissive

* What does this button do?

* Try just 3.9

* Try 3.10

* Back to 3.8

* Try pre-installing protobuf

* Clean up

* Clean up better
2022-06-28 11:22:53 -07:00
Esun Kim ec58a346f9
Changed C99 to C11 (#29687)
* Changed C99 to C11

* Remove gnu99 option

* Switch to gnu11 for xcode
2022-05-20 14:03:04 -07:00
Jan Tattermusch f23f1bb51f
Use ccache for selected C++ and python builds (with redis server as cache) (#28661)
* add cmake support for ccache

* cleanup: use --env-file for docker run invocations

* make python build compatible with using ccache

* enable building using ccache in selected kokoro jobs

* print ccache stats and the end of run_tests.py
2022-01-25 19:18:58 +01:00
Lidi Zheng 7069770ee0
Merge the 3 repeating Python binary compilations (Attempt 2) (#28543)
* Revert "Revert "Merge the 3 repeating Python binary compilations (#28500)" (#28539)"

This reverts commit 0554cbee9c.

* Update hardcoded Python path

* Repect existing images and only use new path for newer releases

* fix interop_matrix testcases

Co-authored-by: Jan Tattermusch <jtattermusch@google.com>
2022-01-14 09:25:33 -08:00
Jan Tattermusch 0554cbee9c
Revert "Merge the 3 repeating Python binary compilations (#28500)" (#28539)
This reverts commit 2d4f3c5600.
2022-01-12 18:31:02 +01:00
Lidi Zheng 2d4f3c5600
Merge the 3 repeating Python binary compilations (#28500)
* Merge the 3 repeating Python binary compilations

* Restore grpcio_metadata.py

* run_tests.py is running on <3.6

* Restore the Windows gevent version pin
2022-01-11 17:14:22 -08:00
Lidi Zheng 83e7cb24fe
Fix the setuptools distutils overriding issue (#28393)
* Fix the distutil install issue

* Try to move setuptools install forward

* Try pin the distribution tools

* Enforce local distutil

* Fix script order of definition

* Add comment

* Try to fix the setuptool monkey patch

* Clean-up imports for commands.py

* Pin 59.6.0 instead of 59.7.0 (incomplete release)
2021-12-21 12:27:01 -08:00
Lidi Zheng 25f5399b41
Add grpcio-admin Python package (#26166)
* Add grpcio-admin Python package

* Polish package content

* Make Linux artifact build happy

* Improve documentation
2021-05-05 13:20:50 -07:00
Lidi Zheng dc63d6a53e
Add CSDS API to Python (#26114)
* Add grpcio-csds pacakge

* Remove unused file

* Fix the proto import path issue

* Update the CSDS package and xds-protos for PY2

* Make tests happy

* Fix Bazel proto dependency

* Add Python2 tests for CSDS
2021-05-03 11:54:34 -07:00
Richard Belleville 1437dc9816
Fix pypa link (#25647)
* Fix pypa link

* And 3.5 as well
2021-03-08 17:26:52 -08:00
Donna Dionne a734650728 Modify build_python.sh because get-pip.py has moved. 2021-01-25 12:49:39 -08:00
Lidi Zheng 5527e0f328 Simplify the check with existing if 2020-09-29 13:28:45 -07:00
Lidi Zheng 0bd1c6ae28 Check $VENV_PYTHON instead of python 2020-09-29 13:27:46 -07:00
Lidi Zheng c45f50581b Don't install enum34 for non-2.7 Python 2020-09-29 13:25:56 -07:00
Lidi Zheng c8fa1c9978 Pin setuptools in one more location 2020-08-31 12:26:24 -07:00
Lidi Zheng 18054754c5 Install rsa==4.0 to avoid the egg cache race issue 2020-06-15 14:19:54 -07:00
Lidi Zheng 43a574d1ae Trust google-auth library will handle their dependency properly 2020-06-15 13:32:28 -07:00
Lidi Zheng 3f9e2148eb Fix typo ras -> rsa 2020-06-12 11:14:44 -07:00
Lidi Zheng 25491305ff Pin to 4.3 instead of 4.0 2020-06-12 10:57:57 -07:00
Lidi Zheng 9a3ae47658 Pump up the minimum version of google-auth to 1.17.1 2020-06-12 10:48:47 -07:00
Richard Belleville 1c1321ddea Indentation 2020-04-07 16:10:20 -07:00
Richard Belleville dbf3bb31cd Shellcheck 2020-04-07 11:09:27 -07:00
Richard Belleville fb2b2122ac Add quotes 2020-04-06 14:21:00 -07:00
Richard Belleville 9344a259b5 Fix MacOS Python 3.5 gevent build 2020-04-06 13:06:35 -07:00
Lidi Zheng b2f72702c9 Pin virtualenv to 16.7.9 2020-02-11 11:05:23 -08:00
Lidi Zheng fe919dd71e Pin to 19.3.1 2019-12-19 10:53:55 -08:00
Lidi Zheng f692cf520a Upgrade the Cython version whenever we can 2019-12-11 11:59:31 -08:00
Lidi Zheng 61d463672d Windows' gevent is always special! 2019-10-31 13:39:43 -07:00
Lidi Zheng 52b5c5a575 Make shellcheck happy 2019-10-25 13:05:05 -07:00
Lidi Zheng ac6d942a5b Make the speed up of compilation automatic on Linux 2019-10-25 11:26:19 -07:00