Skip to content

Commit

Permalink
feat: [Many APIs] Add support for Python 3.12 (#12067)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 586460538

Source-Link:
googleapis/googleapis@44582d0

Source-Link:
googleapis/googleapis-gen@5e7073c
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwcHMtc2NyaXB0LXR5cGUvLk93bEJvdC55YW1sIiwiaCI6IjVlNzA3M2M5ZGU4NDc5MjljNGFlOTdmOGE0NDRjM2ZjYTJkNDVhNmIifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFsbG95ZGIvLk93bEJvdC55YW1sIiwiaCI6IjVlNzA3M2M5ZGU4NDc5MjljNGFlOTdmOGE0NDRjM2ZjYTJkNDVhNmIifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFzc2V0Ly5Pd2xCb3QueWFtbCIsImgiOiI1ZTcwNzNjOWRlODQ3OTI5YzRhZTk3ZjhhNDQ0YzNmY2EyZDQ1YTZiIn0=
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbW1vbi8uT3dsQm90LnlhbWwiLCJoIjoiNWU3MDczYzlkZTg0NzkyOWM0YWU5N2Y4YTQ0NGMzZmNhMmQ0NWE2YiJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRhdGFwcm9jLW1ldGFzdG9yZS8uT3dsQm90LnlhbWwiLCJoIjoiNWU3MDczYzlkZTg0NzkyOWM0YWU5N2Y4YTQ0NGMzZmNhMmQ0NWE2YiJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRscC8uT3dsQm90LnlhbWwiLCJoIjoiNWU3MDczYzlkZTg0NzkyOWM0YWU5N2Y4YTQ0NGMzZmNhMmQ0NWE2YiJ9
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ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_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 committed Dec 1, 2023
1 parent 31d043d commit 5cd98aa
Show file tree
Hide file tree
Showing 66 changed files with 745 additions and 703 deletions.
34 changes: 18 additions & 16 deletions packages/google-cloud-common/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-cloud-common`` `repo`_ on GitHub.
``google-cloud-python`` `repo`_ on GitHub.

- Fork and clone the ``python-cloud-common`` 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-cloud-common`` 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-cloud-common``. E.g.::
as ``hack-on-google-cloud-python``. E.g.::

$ cd ${HOME}
$ git clone git@github.com:USERNAME/python-cloud-common.git hack-on-python-cloud-common
$ cd hack-on-python-cloud-common
# Configure remotes such that you can pull changes from the googleapis/python-cloud-common
$ 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-cloud-common.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-cloud-common
.. _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-cloud-common``. 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-cloud-common/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-common
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-cloud-common/blob/main/packages/google-cloud-common/noxfile.py
.. _config: https://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-common/noxfile.py


**********
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-common/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-common",
"github_user": "googleapis",
"github_repo": "python-cloud-common",
"github_repo": "google-cloud-python",
"github_banner": True,
"font_family": "'Roboto', Georgia, sans",
"head_font_family": "'Roboto', Georgia, serif",
Expand Down
6 changes: 3 additions & 3 deletions packages/google-cloud-common/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

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 @@ -49,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 @@ -339,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
20 changes: 10 additions & 10 deletions packages/google-cloud-common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#
import io
import os
import re

import setuptools # type: ignore

Expand All @@ -25,10 +26,12 @@

description = "Google Cloud Common API client library"

version = {}
version = None

with open(os.path.join(package_root, "google/cloud/common/gapic_version.py")) as fp:
exec(fp.read(), version)
version = version["__version__"]
version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read())
assert len(version_candidates) == 1
version = version_candidates[0]

if version[0] == "0":
release_status = "Development Status :: 4 - Beta"
Expand All @@ -37,11 +40,10 @@

dependencies = [
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
"proto-plus >= 1.22.0, <2.0.0dev",
"proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'",
"proto-plus >= 1.22.3, <2.0.0dev",
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
]
url = "https://github.com/googleapis/google-cloud-python"
url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-common"

package_root = os.path.abspath(os.path.dirname(__file__))

Expand All @@ -51,12 +53,10 @@

packages = [
package
for package in setuptools.PEP420PackageFinder.find()
for package in setuptools.find_namespace_packages()
if package.startswith("google")
]

namespaces = ["google", "google.cloud"]

setuptools.setup(
name=name,
version=version,
Expand All @@ -77,13 +77,13 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Topic :: Internet",
],
platforms="Posix; MacOS X; Windows",
packages=packages,
python_requires=">=3.7",
namespace_packages=namespaces,
install_requires=dependencies,
include_package_data=True,
zip_safe=False,
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-common/testing/constraints-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
# Then this file should have google-cloud-foo==1.14.0
google-api-core==1.34.0
proto-plus==1.22.0
proto-plus==1.22.3
protobuf==3.19.5
10 changes: 6 additions & 4 deletions packages/google-cloud-dlp/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 Down Expand Up @@ -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 @@ -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 @@ -226,12 +226,14 @@ 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`_.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.13.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.13.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Loading

0 comments on commit 5cd98aa

Please sign in to comment.