From 19dc0338ce3be1cca10da3e0c71129dbf3aa3a67 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 03:44:29 +0000 Subject: [PATCH 01/15] migrate to pyproject.toml --- pyproject.toml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 50 -------------------------------------------------- 2 files changed, 48 insertions(+), 50 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9c8ae2a1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,48 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "google-api-core" +version = "2.21.0" +authors = [{ name = "Google LLC", email = "googleapis-packages@google.com" }] +license = { text = "Apache 2.0" } +requires-python = ">=3.7" +readme = "README.rst" +classifiers = [ + # Should be one of: + # "Development Status :: 3 - Alpha" + # "Development Status :: 4 - Beta" + # "Development Status :: 5 - Production/Stable" + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "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", +] +dependencies = [ + "googleapis-common-protos >= 1.56.2, < 2.0.dev0", + "protobuf>=3.19.5,<6.0.0.dev0,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "proto-plus >= 1.22.3, <2.0.0dev", + "google-auth >= 2.14.1, < 3.0.dev0", + "requests >= 2.18.0, < 3.0.0.dev0", +] + +[project.optional-dependencies] +async_rest = ["google-auth[aiohttp] >= 2.35.0, < 3.0.dev0"] +grpc = [ + "grpcio >= 1.33.2, < 2.0dev", + "grpcio >= 1.49.1, < 2.0dev; python_version>='3.11'", + "grpcio-status >= 1.33.2, < 2.0.dev0", + "grpcio-status >= 1.49.1, < 2.0.dev0; python_version>='3.11'", +] +grpcgcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"] +grpcio-gcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"] diff --git a/setup.py b/setup.py index d3c2a2b4..2655e78b 100644 --- a/setup.py +++ b/setup.py @@ -20,36 +20,8 @@ # Package metadata. -name = "google-api-core" description = "Google API client core library" -# Should be one of: -# 'Development Status :: 3 - Alpha' -# 'Development Status :: 4 - Beta' -# 'Development Status :: 5 - Production/Stable' -release_status = "Development Status :: 5 - Production/Stable" -dependencies = [ - "googleapis-common-protos >= 1.56.2, < 2.0.dev0", - "protobuf>=3.19.5,<6.0.0.dev0,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - "proto-plus >= 1.22.3, <2.0.0dev", - "google-auth >= 2.14.1, < 3.0.dev0", - "requests >= 2.18.0, < 3.0.0.dev0", -] -extras = { - "async_rest": [ - "google-auth[aiohttp] >= 2.35.0, < 3.0.dev0", - ], - "grpc": [ - "grpcio >= 1.33.2, < 2.0dev", - "grpcio >= 1.49.1, < 2.0dev; python_version>='3.11'", - "grpcio-status >= 1.33.2, < 2.0.dev0", - "grpcio-status >= 1.49.1, < 2.0.dev0; python_version>='3.11'", - ], - "grpcgcp": "grpcio-gcp >= 0.2.2, < 1.0.dev0", - "grpcio-gcp": "grpcio-gcp >= 0.2.2, < 1.0.dev0", -} - - # Setup boilerplate below this line. package_root = os.path.abspath(os.path.dirname(__file__)) @@ -73,34 +45,12 @@ ] setuptools.setup( - name=name, version=version, description=description, long_description=readme, - author="Google LLC", - author_email="googleapis-packages@google.com", - license="Apache 2.0", url="https://github.com/googleapis/python-api-core", - classifiers=[ - release_status, - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "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, - install_requires=dependencies, - extras_require=extras, - python_requires=">=3.7", include_package_data=True, zip_safe=False, ) From 20d195400c8129c3b8180fe6498e232dfcc38751 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 03:45:47 +0000 Subject: [PATCH 02/15] remove version --- setup.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/setup.py b/setup.py index 2655e78b..7ba22bd9 100644 --- a/setup.py +++ b/setup.py @@ -26,12 +26,6 @@ package_root = os.path.abspath(os.path.dirname(__file__)) - -version = {} -with open(os.path.join(package_root, "google/api_core/version.py")) as fp: - exec(fp.read(), version) -version = version["__version__"] - readme_filename = os.path.join(package_root, "README.rst") with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() @@ -45,7 +39,6 @@ ] setuptools.setup( - version=version, description=description, long_description=readme, url="https://github.com/googleapis/python-api-core", From dd88d2da1e27ba0f636342e4a36ff6c8491e521a Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 03:46:18 +0000 Subject: [PATCH 03/15] remove readme_filename --- setup.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setup.py b/setup.py index 7ba22bd9..64f060a7 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import io import os import setuptools @@ -26,10 +25,6 @@ package_root = os.path.abspath(os.path.dirname(__file__)) -readme_filename = os.path.join(package_root, "README.rst") -with io.open(readme_filename, encoding="utf-8") as readme_file: - readme = readme_file.read() - # Only include packages under the 'google' namespace. Do not include tests, # benchmarks, etc. packages = [ From 2fcc363cddca00ee8c49d220cfaa8cc446c34cb9 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 03:46:39 +0000 Subject: [PATCH 04/15] remove long_description --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 64f060a7..5a40a76b 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,6 @@ setuptools.setup( description=description, - long_description=readme, url="https://github.com/googleapis/python-api-core", platforms="Posix; MacOS X; Windows", packages=packages, From cf50f86e1e18ac00d6f570f1481ae562458b08f2 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 04:38:32 +0000 Subject: [PATCH 05/15] dynamic version --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9c8ae2a1..0c478120 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,9 @@ [build-system] -requires = ["setuptools", "setuptools-scm"] +requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "google-api-core" -version = "2.21.0" authors = [{ name = "Google LLC", email = "googleapis-packages@google.com" }] license = { text = "Apache 2.0" } requires-python = ">=3.7" @@ -35,6 +34,7 @@ dependencies = [ "google-auth >= 2.14.1, < 3.0.dev0", "requests >= 2.18.0, < 3.0.0.dev0", ] +dynamic = ["version"] [project.optional-dependencies] async_rest = ["google-auth[aiohttp] >= 2.35.0, < 3.0.dev0"] @@ -46,3 +46,6 @@ grpc = [ ] grpcgcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"] grpcio-gcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"] + +[tool.setuptools.dynamic] +version = { attr = "google.api_core.version.__version__" } From 5d94cbec58a933e634e6afb53482c2fdc86b4dfd Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 04:39:30 +0000 Subject: [PATCH 06/15] move description --- pyproject.toml | 1 + setup.py | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0c478120..d26e201d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ authors = [{ name = "Google LLC", email = "googleapis-packages@google.com" }] license = { text = "Apache 2.0" } requires-python = ">=3.7" readme = "README.rst" +description = "Google API client core library" classifiers = [ # Should be one of: # "Development Status :: 3 - Alpha" diff --git a/setup.py b/setup.py index 5a40a76b..60e65cda 100644 --- a/setup.py +++ b/setup.py @@ -17,10 +17,6 @@ import setuptools -# Package metadata. - -description = "Google API client core library" - # Setup boilerplate below this line. package_root = os.path.abspath(os.path.dirname(__file__)) @@ -34,7 +30,6 @@ ] setuptools.setup( - description=description, url="https://github.com/googleapis/python-api-core", platforms="Posix; MacOS X; Windows", packages=packages, From 99c58d972abc6e7951595d3137f900562b955b64 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 07:46:44 +0000 Subject: [PATCH 07/15] move urls --- pyproject.toml | 4 ++++ setup.py | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d26e201d..b8b925cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,10 @@ dependencies = [ ] dynamic = ["version"] +[project.urls] +Documentation = "https://googleapis.dev/python/google-api-core/latest/" +Repository = "https://github.com/googleapis/python-api-core" + [project.optional-dependencies] async_rest = ["google-auth[aiohttp] >= 2.35.0, < 3.0.dev0"] grpc = [ diff --git a/setup.py b/setup.py index 60e65cda..a0f14e89 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,6 @@ ] setuptools.setup( - url="https://github.com/googleapis/python-api-core", platforms="Posix; MacOS X; Windows", packages=packages, include_package_data=True, From e71b8df043419c4bbdaa0fc230ec41d7fb3d4f3d Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Tue, 15 Oct 2024 08:20:20 +0000 Subject: [PATCH 08/15] move packages --- pyproject.toml | 5 +++++ setup.py | 15 --------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b8b925cc..cb42b133 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,3 +54,8 @@ grpcio-gcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"] [tool.setuptools.dynamic] version = { attr = "google.api_core.version.__version__" } + +[tool.setuptools.packages.find] +# Only include packages under the 'google' namespace. Do not include tests, +# benchmarks, etc. +include = ["google*"] diff --git a/setup.py b/setup.py index a0f14e89..141741c5 100644 --- a/setup.py +++ b/setup.py @@ -12,26 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os - import setuptools -# Setup boilerplate below this line. - -package_root = os.path.abspath(os.path.dirname(__file__)) - -# Only include packages under the 'google' namespace. Do not include tests, -# benchmarks, etc. -packages = [ - package - for package in setuptools.find_namespace_packages() - if package.startswith("google") -] - setuptools.setup( platforms="Posix; MacOS X; Windows", - packages=packages, include_package_data=True, zip_safe=False, ) From e608c085820ac05e5671dc9728ecd5d176802dfd Mon Sep 17 00:00:00 2001 From: Rin Arakaki Date: Tue, 15 Oct 2024 17:28:40 +0900 Subject: [PATCH 09/15] zip_safe is deprecated --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 141741c5..e8a3aa23 100644 --- a/setup.py +++ b/setup.py @@ -18,5 +18,4 @@ setuptools.setup( platforms="Posix; MacOS X; Windows", include_package_data=True, - zip_safe=False, ) From 3c8d3ebd9334c0e9c677d68410c1302f7b67ab79 Mon Sep 17 00:00:00 2001 From: Rin Arakaki Date: Tue, 15 Oct 2024 17:31:50 +0900 Subject: [PATCH 10/15] include-package-data = true by default --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index e8a3aa23..73932a21 100644 --- a/setup.py +++ b/setup.py @@ -17,5 +17,4 @@ setuptools.setup( platforms="Posix; MacOS X; Windows", - include_package_data=True, ) From 86c6db0ad6fb78776ba140c966d9ad4ffe0099fc Mon Sep 17 00:00:00 2001 From: Rin Arakaki Date: Tue, 15 Oct 2024 17:40:59 +0900 Subject: [PATCH 11/15] platforms are ignored --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 73932a21..168877fa 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,4 @@ import setuptools -setuptools.setup( - platforms="Posix; MacOS X; Windows", -) +setuptools.setup() From 94d1e0de09eee8f8e6e08315924376d465a089b6 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Sat, 19 Oct 2024 13:39:54 -0400 Subject: [PATCH 12/15] Add copyright notice --- pyproject.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8f010cc4..ab810f4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" From 3b5597bb7c1afa0fcd8b290b4a4ff420b6eff7c2 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Sun, 20 Oct 2024 04:36:46 +0000 Subject: [PATCH 13/15] proto-plus when python_version >= '3.13' --- pyproject.toml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ab810f4d..daa6e2b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,8 +45,9 @@ classifiers = [ ] dependencies = [ "googleapis-common-protos >= 1.56.2, < 2.0.dev0", - "protobuf>=3.19.5,<6.0.0.dev0,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - "proto-plus >= 1.22.3, <2.0.0dev", + "protobuf >= 3.19.5, < 6.0.0.dev0, != 3.20.0, != 3.20.1, != 4.21.0, != 4.21.1, != 4.21.2, != 4.21.3, != 4.21.4, != 4.21.5", + "proto-plus >= 1.22.3, < 2.0.0dev", + "proto-plus >= 1.25.0, < 2.0.0dev; python_version >= '3.13'", "google-auth >= 2.14.1, < 3.0.dev0", "requests >= 2.18.0, < 3.0.0.dev0", ] @@ -60,9 +61,9 @@ Repository = "https://github.com/googleapis/python-api-core" async_rest = ["google-auth[aiohttp] >= 2.35.0, < 3.0.dev0"] grpc = [ "grpcio >= 1.33.2, < 2.0dev", - "grpcio >= 1.49.1, < 2.0dev; python_version>='3.11'", + "grpcio >= 1.49.1, < 2.0dev; python_version >= '3.11'", "grpcio-status >= 1.33.2, < 2.0.dev0", - "grpcio-status >= 1.49.1, < 2.0.dev0; python_version>='3.11'", + "grpcio-status >= 1.49.1, < 2.0.dev0; python_version >= '3.11'", ] grpcgcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"] grpcio-gcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"] From 0f2b0b88f2e21a882db3bc6be09aebf94f6955b2 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Sun, 20 Oct 2024 14:43:34 +0000 Subject: [PATCH 14/15] remove mypy.ini --- mypy.ini | 4 ---- pyproject.toml | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 mypy.ini diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index ce33582a..00000000 --- a/mypy.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True -ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index daa6e2b3..bbd9ac20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,3 +75,8 @@ version = { attr = "google.api_core.version.__version__" } # Only include packages under the 'google' namespace. Do not include tests, # benchmarks, etc. include = ["google*"] + +[tool.mypy] +python_version = "3.7" +namespace_packages = true +ignore_missing_imports = true From c94b615220cdda6aae9731b44cb4da82d62193e9 Mon Sep 17 00:00:00 2001 From: rinarakaki Date: Sun, 20 Oct 2024 14:51:12 +0000 Subject: [PATCH 15/15] remove pytest.ini --- pyproject.toml | 25 +++++++++++++++++++++++++ pytest.ini | 23 ----------------------- 2 files changed, 25 insertions(+), 23 deletions(-) delete mode 100644 pytest.ini diff --git a/pyproject.toml b/pyproject.toml index bbd9ac20..fda8f01b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,3 +80,28 @@ include = ["google*"] python_version = "3.7" namespace_packages = true ignore_missing_imports = true + +[tool.pytest] +filterwarnings = [ + # treat all warnings as errors + "error", + # Remove once https://github.com/pytest-dev/pytest-cov/issues/621 is fixed + "ignore:.*The --rsyncdir command line argument and rsyncdirs config variable are deprecated:DeprecationWarning", + # Remove once https://github.com/protocolbuffers/protobuf/issues/12186 is fixed + "ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning", + # Remove once support for python 3.7 is dropped + # This warning only appears when using python 3.7 + "ignore:.*Using or importing the ABCs from.*collections:DeprecationWarning", + # Remove once support for grpcio-gcp is deprecated + # See https://github.com/googleapis/python-api-core/blob/42e8b6e6f426cab749b34906529e8aaf3f133d75/google/api_core/grpc_helpers.py#L39-L45 + "ignore:.*Support for grpcio-gcp is deprecated:DeprecationWarning", + "ignore: The `compression` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning", + "ignore:The `attempt_direct_path` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning", + # Remove once the minimum supported version of googleapis-common-protos is 1.62.0 + "ignore:.*pkg_resources.declare_namespace:DeprecationWarning", + "ignore:.*pkg_resources is deprecated as an API:DeprecationWarning", + # Remove once https://github.com/grpc/grpc/issues/35086 is fixed (and version newer than 1.60.0 is published) + "ignore:There is no current event loop:DeprecationWarning", + # Remove after support for Python 3.7 is dropped + "ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning", +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 696548cf..00000000 --- a/pytest.ini +++ /dev/null @@ -1,23 +0,0 @@ -[pytest] -filterwarnings = - # treat all warnings as errors - error - # Remove once https://github.com/pytest-dev/pytest-cov/issues/621 is fixed - ignore:.*The --rsyncdir command line argument and rsyncdirs config variable are deprecated:DeprecationWarning - # Remove once https://github.com/protocolbuffers/protobuf/issues/12186 is fixed - ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning - # Remove once support for python 3.7 is dropped - # This warning only appears when using python 3.7 - ignore:.*Using or importing the ABCs from.*collections:DeprecationWarning - # Remove once support for grpcio-gcp is deprecated - # See https://github.com/googleapis/python-api-core/blob/42e8b6e6f426cab749b34906529e8aaf3f133d75/google/api_core/grpc_helpers.py#L39-L45 - ignore:.*Support for grpcio-gcp is deprecated:DeprecationWarning - ignore: The `compression` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning - ignore:The `attempt_direct_path` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning - # Remove once the minimum supported version of googleapis-common-protos is 1.62.0 - ignore:.*pkg_resources.declare_namespace:DeprecationWarning - ignore:.*pkg_resources is deprecated as an API:DeprecationWarning - # Remove once https://github.com/grpc/grpc/issues/35086 is fixed (and version newer than 1.60.0 is published) - ignore:There is no current event loop:DeprecationWarning - # Remove after support for Python 3.7 is dropped - ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning