Skip to content

Commit

Permalink
feat: [Many APIs] added Generator API (#12076)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

docs: updated doc for speech mode

PiperOrigin-RevId: 586469693

Source-Link:
googleapis/googleapis@e8148d6

Source-Link:
googleapis/googleapis-gen@85136bd
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRyYWNlLy5Pd2xCb3QueWFtbCIsImgiOiI4NTEzNmJkMDQzODNlZDcxNzJiYjE4YjdiOGQyMjBkZDdmZjZiM2EwIn0=
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRyYW5zbGF0ZS8uT3dsQm90LnlhbWwiLCJoIjoiODUxMzZiZDA0MzgzZWQ3MTcyYmIxOGI3YjhkMjIwZGQ3ZmY2YjNhMCJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZpZGVvaW50ZWxsaWdlbmNlLy5Pd2xCb3QueWFtbCIsImgiOiI4NTEzNmJkMDQzODNlZDcxNzJiYjE4YjdiOGQyMjBkZDdmZjZiM2EwIn0=
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZpc2lvbi8uT3dsQm90LnlhbWwiLCJoIjoiODUxMzZiZDA0MzgzZWQ3MTcyYmIxOGI3YjhkMjIwZGQ3ZmY2YjNhMCJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZwYy1hY2Nlc3MvLk93bEJvdC55YW1sIiwiaCI6Ijg1MTM2YmQwNDM4M2VkNzE3MmJiMThiN2I4ZDIyMGRkN2ZmNmIzYTAifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnJpc2svLk93bEJvdC55YW1sIiwiaCI6Ijg1MTM2YmQwNDM4M2VkNzE3MmJiMThiN2I4ZDIyMGRkN2ZmNmIzYTAifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnNlY3VyaXR5c2Nhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiODUxMzZiZDA0MzgzZWQ3MTcyYmIxOGI3YjhkMjIwZGQ3ZmY2YjNhMCJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtmbG93cy8uT3dsQm90LnlhbWwiLCJoIjoiODUxMzZiZDA0MzgzZWQ3MTcyYmIxOGI3YjhkMjIwZGQ3ZmY2YjNhMCJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtzdGF0aW9ucy8uT3dsQm90LnlhbWwiLCJoIjoiODUxMzZiZDA0MzgzZWQ3MTcyYmIxOGI3YjhkMjIwZGQ3ZmY2YjNhMCJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtZmxlZXRlbmdpbmUtZGVsaXZlcnkvLk93bEJvdC55YW1sIiwiaCI6Ijg1MTM2YmQwNDM4M2VkNzE3MmJiMThiN2I4ZDIyMGRkN2ZmNmIzYTAifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtZmxlZXRlbmdpbmUvLk93bEJvdC55YW1sIiwiaCI6Ijg1MTM2YmQwNDM4M2VkNzE3MmJiMThiN2I4ZDIyMGRkN2ZmNmIzYTAifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLXR5cGUvLk93bEJvdC55YW1sIiwiaCI6Ijg1MTM2YmQwNDM4M2VkNzE3MmJiMThiN2I4ZDIyMGRkN2ZmNmIzYTAifQ==

BEGIN_COMMIT_OVERRIDE
feat: Add support for python 3.12
feat: Introduce compatibility with native namespace packages
fix: Use `retry_async` instead of `retry` in async client
fix: Require proto-plus >= 1.22.3
END_COMMIT_OVERRIDE

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Dec 1, 2023
1 parent 5f574d6 commit f920d22
Show file tree
Hide file tree
Showing 110 changed files with 936 additions and 920 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10', "3.11"]
python: ['3.7', '3.8', '3.9', '3.10', "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.11']
python: ['3.12']
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/continuous/system.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "system-3.11"
value: "system-3.12"
}
2 changes: 1 addition & 1 deletion .kokoro/presubmit/system.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "system-3.11"
value: "system-3.12"
}
8 changes: 1 addition & 7 deletions ci/run_conditional_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# This script requires the following environment variables to be set:
# `BUILD_TYPE` should be one of ["presubmit", "continuous"]
# `TEST_TYPE` should be one of ["lint", "lint_setup_py", "docs", "docfx", "prerelease"]
# `PY_VERSION` should be one of ["3.7", "3.8", "3.9", "3.10", "3.11"]
# `PY_VERSION` should be one of ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

# `TEST_TYPE` and `PY_VERSION` are required by the script `ci/run_single_test.sh`

Expand Down Expand Up @@ -64,12 +64,6 @@ set +e
git diff --quiet ${GIT_DIFF_ARG} ci
changed=$?
set -e
if [[ "${changed}" -eq 0 ]]; then
echo "no change detected in ci"
else
echo "change detected in ci, we should test everything"
GIT_DIFF_ARG=""
fi

# Now we have a fixed list, but we can change it to autodetect if
# necessary.
Expand Down
8 changes: 6 additions & 2 deletions ci/run_single_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# This script requires the following environment variables to be set:
# `TEST_TYPE` should be one of ["lint", "lint_setup_py", "docs", "docfx", "prerelease"]
# `PY_VERSION` should be one of ["3.7", "3.8", "3.9", "3.10", "3.11"]
# `PY_VERSION` should be one of ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

# This script is called by the `ci/run_conditional_tests.sh` script.
# A specific `nox` session will be run, depending on the value of
Expand Down Expand Up @@ -57,7 +57,7 @@ case ${TEST_TYPE} in
retval=$?
;;
prerelease)
nox -s prerelease_deps-3.11
nox -s prerelease_deps-3.12
retval=$?
;;
unit)
Expand All @@ -82,6 +82,10 @@ case ${TEST_TYPE} in
nox -s unit-3.11
retval=$?
;;
"3.12")
nox -s unit-3.12
retval=$?
;;
*)
;;
esac
Expand Down
34 changes: 18 additions & 16 deletions packages/google-cloud-trace/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ In order to add a feature:
documentation.

- The feature must work fully on the following CPython versions:
3.7, 3.8, 3.9, 3.10 and 3.11 on both UNIX and Windows.
3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 on both UNIX and Windows.

- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
Expand All @@ -35,21 +35,21 @@ Using a Development Checkout
You'll have to create a development environment using a Git checkout:

- While logged into your GitHub account, navigate to the
``python-trace`` `repo`_ on GitHub.
``google-cloud-python`` `repo`_ on GitHub.

- Fork and clone the ``python-trace`` repository to your GitHub account by
- Fork and clone the ``google-cloud-python`` repository to your GitHub account by
clicking the "Fork" button.

- Clone your fork of ``python-trace`` from your GitHub account to your local
- Clone your fork of ``google-cloud-python`` from your GitHub account to your local
computer, substituting your account username and specifying the destination
as ``hack-on-python-trace``. E.g.::
as ``hack-on-google-cloud-python``. E.g.::

$ cd ${HOME}
$ git clone git@github.com:USERNAME/python-trace.git hack-on-python-trace
$ cd hack-on-python-trace
# Configure remotes such that you can pull changes from the googleapis/python-trace
$ git clone git@github.com:USERNAME/google-cloud-python.git hack-on-google-cloud-python
$ cd hack-on-google-cloud-python
# Configure remotes such that you can pull changes from the googleapis/google-cloud-python
# repository into your local repository.
$ git remote add upstream git@github.com:googleapis/python-trace.git
$ git remote add upstream git@github.com:googleapis/google-cloud-python.git
# fetch and merge changes from upstream into main
$ git fetch upstream
$ git merge upstream/main
Expand All @@ -60,7 +60,7 @@ repo, from which you can submit a pull request.
To work on the codebase and run the tests, we recommend using ``nox``,
but you can also use a ``virtualenv`` of your own creation.

.. _repo: https://github.com/googleapis/python-trace
.. _repo: https://github.com/googleapis/google-cloud-python

Using ``nox``
=============
Expand All @@ -72,7 +72,7 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.

- To run a single unit test::

$ nox -s unit-3.11 -- -k <name of test>
$ nox -s unit-3.12 -- -k <name of test>


.. note::
Expand Down Expand Up @@ -113,7 +113,7 @@ Coding Style
export GOOGLE_CLOUD_TESTING_BRANCH="main"

By doing this, you are specifying the location of the most up-to-date
version of ``python-trace``. The
version of ``google-cloud-python``. The
remote name ``upstream`` should point to the official ``googleapis``
checkout and the branch should be the default branch on that remote (``main``).

Expand Down Expand Up @@ -143,12 +143,12 @@ Running System Tests
$ nox -s system

# Run a single system test
$ nox -s system-3.11 -- -k <name of test>
$ nox -s system-3.12 -- -k <name of test>


.. note::

System tests are only configured to run under Python 3.8, 3.9, 3.10 and 3.11.
System tests are only configured to run under Python 3.8, 3.9, 3.10, 3.11 and 3.12.
For expediency, we do not run them in older versions of Python 3.

This alone will not run the tests. You'll need to change some local
Expand Down Expand Up @@ -209,7 +209,7 @@ The `description on PyPI`_ for the project comes directly from the
``README``. Due to the reStructuredText (``rst``) parser used by
PyPI, relative links which will work on GitHub (e.g. ``CONTRIBUTING.rst``
instead of
``https://github.com/googleapis/python-trace/blob/main/CONTRIBUTING.rst``)
``https://github.com/googleapis/google-cloud-python/blob/main/CONTRIBUTING.rst``)
may cause problems creating links or rendering the description.

.. _description on PyPI: https://pypi.org/project/google-cloud-trace
Expand All @@ -226,17 +226,19 @@ We support:
- `Python 3.9`_
- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_

.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
.. _Python 3.12: https://docs.python.org/3.12/


Supported versions can be found in our ``noxfile.py`` `config`_.

.. _config: https://github.com/googleapis/python-trace/blob/main/packages/google-cloud-trace/noxfile.py
.. _config: https://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-trace/noxfile.py


**********
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-trace/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
html_theme_options = {
"description": "Google Cloud Client Libraries for google-cloud-trace",
"github_user": "googleapis",
"github_repo": "python-trace",
"github_repo": "google-cloud-python",
"github_banner": True,
"font_family": "'Roboto', Georgia, sans",
"head_font_family": "'Roboto', Georgia, serif",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@

from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

from google.cloud.trace_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore

from google.cloud.trace_v1.services.trace_service import pagers
from google.cloud.trace_v1.types import trace
Expand Down Expand Up @@ -264,7 +264,7 @@ async def sample_list_traces():
This corresponds to the ``project_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -299,7 +299,7 @@ async def sample_list_traces():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.list_traces,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=1.0,
multiplier=1.2,
Expand Down Expand Up @@ -395,7 +395,7 @@ async def sample_get_trace():
This corresponds to the ``trace_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -433,7 +433,7 @@ async def sample_get_trace():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.get_trace,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=1.0,
multiplier=1.2,
Expand Down Expand Up @@ -525,7 +525,7 @@ async def sample_patch_traces():
This corresponds to the ``traces`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -554,7 +554,7 @@ async def sample_patch_traces():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.patch_traces,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=1.0,
multiplier=1.2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@

from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

from google.cloud.trace_v2 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore

from google.protobuf import timestamp_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
Expand Down Expand Up @@ -281,7 +281,7 @@ async def sample_batch_write_spans():
This corresponds to the ``spans`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -310,7 +310,7 @@ async def sample_batch_write_spans():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.batch_write_spans,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=30.0,
multiplier=2,
Expand Down Expand Up @@ -388,7 +388,7 @@ async def sample_create_span():
spans, or none at all. Spans do not need
to be contiguous. There might be gaps or
overlaps between spans in a trace.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -416,7 +416,7 @@ async def sample_create_span():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_span,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.1,
maximum=1.0,
multiplier=1.2,
Expand Down
9 changes: 6 additions & 3 deletions packages/google-cloud-trace/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@

BLACK_VERSION = "black[jupyter]==23.7.0"
ISORT_VERSION = "isort==5.11.0"

LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]


DEFAULT_PYTHON_VERSION = "3.10"

UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.7", "3.8", "3.9", "3.10", "3.11"]
UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
"asyncmock",
Expand All @@ -47,7 +49,7 @@
UNIT_TEST_EXTRAS: List[str] = []
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}

SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11"]
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12"]
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
"mock",
"pytest",
Expand Down Expand Up @@ -89,6 +91,7 @@ def lint(session):
"--check",
*LINT_PATHS,
)

session.run("flake8", "google", "tests")


Expand Down Expand Up @@ -336,7 +339,7 @@ def docfx(session):
)


@nox.session(python="3.11")
@nox.session(python="3.12")
def prerelease_deps(session):
"""Run all tests with prerelease versions of dependencies installed."""

Expand Down
Loading

0 comments on commit f920d22

Please sign in to comment.