Skip to content

Commit 159e9a4

Browse files
rinarakakiparthea
andauthoredOct 28, 2024··
feat: migrate to pyproject.toml (#736)
* migrate to pyproject.toml * remove version * remove readme_filename * remove long_description * dynamic version * move description * move urls * move packages * zip_safe is deprecated * include-package-data = true by default * platforms are ignored * Add copyright notice * proto-plus when python_version >= '3.13' * remove mypy.ini * remove pytest.ini --------- Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent e1b5a11 commit 159e9a4

File tree

4 files changed

+108
-118
lines changed

4 files changed

+108
-118
lines changed
 

‎mypy.ini

-4
This file was deleted.

‎pyproject.toml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
[build-system]
16+
requires = ["setuptools"]
17+
build-backend = "setuptools.build_meta"
18+
19+
[project]
20+
name = "google-api-core"
21+
authors = [{ name = "Google LLC", email = "googleapis-packages@google.com" }]
22+
license = { text = "Apache 2.0" }
23+
requires-python = ">=3.7"
24+
readme = "README.rst"
25+
description = "Google API client core library"
26+
classifiers = [
27+
# Should be one of:
28+
# "Development Status :: 3 - Alpha"
29+
# "Development Status :: 4 - Beta"
30+
# "Development Status :: 5 - Production/Stable"
31+
"Development Status :: 5 - Production/Stable",
32+
"Intended Audience :: Developers",
33+
"License :: OSI Approved :: Apache Software License",
34+
"Programming Language :: Python",
35+
"Programming Language :: Python :: 3",
36+
"Programming Language :: Python :: 3.7",
37+
"Programming Language :: Python :: 3.8",
38+
"Programming Language :: Python :: 3.9",
39+
"Programming Language :: Python :: 3.10",
40+
"Programming Language :: Python :: 3.11",
41+
"Programming Language :: Python :: 3.12",
42+
"Programming Language :: Python :: 3.13",
43+
"Operating System :: OS Independent",
44+
"Topic :: Internet",
45+
]
46+
dependencies = [
47+
"googleapis-common-protos >= 1.56.2, < 2.0.dev0",
48+
"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",
49+
"proto-plus >= 1.22.3, < 2.0.0dev",
50+
"proto-plus >= 1.25.0, < 2.0.0dev; python_version >= '3.13'",
51+
"google-auth >= 2.14.1, < 3.0.dev0",
52+
"requests >= 2.18.0, < 3.0.0.dev0",
53+
]
54+
dynamic = ["version"]
55+
56+
[project.urls]
57+
Documentation = "https://googleapis.dev/python/google-api-core/latest/"
58+
Repository = "https://github.com/googleapis/python-api-core"
59+
60+
[project.optional-dependencies]
61+
async_rest = ["google-auth[aiohttp] >= 2.35.0, < 3.0.dev0"]
62+
grpc = [
63+
"grpcio >= 1.33.2, < 2.0dev",
64+
"grpcio >= 1.49.1, < 2.0dev; python_version >= '3.11'",
65+
"grpcio-status >= 1.33.2, < 2.0.dev0",
66+
"grpcio-status >= 1.49.1, < 2.0.dev0; python_version >= '3.11'",
67+
]
68+
grpcgcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"]
69+
grpcio-gcp = ["grpcio-gcp >= 0.2.2, < 1.0.dev0"]
70+
71+
[tool.setuptools.dynamic]
72+
version = { attr = "google.api_core.version.__version__" }
73+
74+
[tool.setuptools.packages.find]
75+
# Only include packages under the 'google' namespace. Do not include tests,
76+
# benchmarks, etc.
77+
include = ["google*"]
78+
79+
[tool.mypy]
80+
python_version = "3.7"
81+
namespace_packages = true
82+
ignore_missing_imports = true
83+
84+
[tool.pytest]
85+
filterwarnings = [
86+
# treat all warnings as errors
87+
"error",
88+
# Remove once https://github.com/pytest-dev/pytest-cov/issues/621 is fixed
89+
"ignore:.*The --rsyncdir command line argument and rsyncdirs config variable are deprecated:DeprecationWarning",
90+
# Remove once https://github.com/protocolbuffers/protobuf/issues/12186 is fixed
91+
"ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning",
92+
# Remove once support for python 3.7 is dropped
93+
# This warning only appears when using python 3.7
94+
"ignore:.*Using or importing the ABCs from.*collections:DeprecationWarning",
95+
# Remove once support for grpcio-gcp is deprecated
96+
# See https://github.com/googleapis/python-api-core/blob/42e8b6e6f426cab749b34906529e8aaf3f133d75/google/api_core/grpc_helpers.py#L39-L45
97+
"ignore:.*Support for grpcio-gcp is deprecated:DeprecationWarning",
98+
"ignore: The `compression` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning",
99+
"ignore:The `attempt_direct_path` argument is ignored for grpc_gcp.secure_channel creation:DeprecationWarning",
100+
# Remove once the minimum supported version of googleapis-common-protos is 1.62.0
101+
"ignore:.*pkg_resources.declare_namespace:DeprecationWarning",
102+
"ignore:.*pkg_resources is deprecated as an API:DeprecationWarning",
103+
# Remove once https://github.com/grpc/grpc/issues/35086 is fixed (and version newer than 1.60.0 is published)
104+
"ignore:There is no current event loop:DeprecationWarning",
105+
# Remove after support for Python 3.7 is dropped
106+
"ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning",
107+
]

‎pytest.ini

-23
This file was deleted.

‎setup.py

+1-91
Original file line numberDiff line numberDiff line change
@@ -12,97 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import io
16-
import os
17-
1815
import setuptools
1916

2017

21-
# Package metadata.
22-
23-
name = "google-api-core"
24-
description = "Google API client core library"
25-
26-
# Should be one of:
27-
# 'Development Status :: 3 - Alpha'
28-
# 'Development Status :: 4 - Beta'
29-
# 'Development Status :: 5 - Production/Stable'
30-
release_status = "Development Status :: 5 - Production/Stable"
31-
dependencies = [
32-
"googleapis-common-protos >= 1.56.2, < 2.0.dev0",
33-
"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",
34-
"proto-plus >= 1.22.3, < 2.0.0dev",
35-
"proto-plus >= 1.25.0, < 2.0.0dev; python_version >= '3.13'",
36-
"google-auth >= 2.14.1, < 3.0.dev0",
37-
"requests >= 2.18.0, < 3.0.0.dev0",
38-
]
39-
extras = {
40-
"async_rest": [
41-
"google-auth[aiohttp] >= 2.35.0, < 3.0.dev0",
42-
],
43-
"grpc": [
44-
"grpcio >= 1.33.2, < 2.0dev",
45-
"grpcio >= 1.49.1, < 2.0dev; python_version>='3.11'",
46-
"grpcio-status >= 1.33.2, < 2.0.dev0",
47-
"grpcio-status >= 1.49.1, < 2.0.dev0; python_version>='3.11'",
48-
],
49-
"grpcgcp": "grpcio-gcp >= 0.2.2, < 1.0.dev0",
50-
"grpcio-gcp": "grpcio-gcp >= 0.2.2, < 1.0.dev0",
51-
}
52-
53-
54-
# Setup boilerplate below this line.
55-
56-
package_root = os.path.abspath(os.path.dirname(__file__))
57-
58-
59-
version = {}
60-
with open(os.path.join(package_root, "google/api_core/version.py")) as fp:
61-
exec(fp.read(), version)
62-
version = version["__version__"]
63-
64-
readme_filename = os.path.join(package_root, "README.rst")
65-
with io.open(readme_filename, encoding="utf-8") as readme_file:
66-
readme = readme_file.read()
67-
68-
# Only include packages under the 'google' namespace. Do not include tests,
69-
# benchmarks, etc.
70-
packages = [
71-
package
72-
for package in setuptools.find_namespace_packages()
73-
if package.startswith("google")
74-
]
75-
76-
setuptools.setup(
77-
name=name,
78-
version=version,
79-
description=description,
80-
long_description=readme,
81-
author="Google LLC",
82-
author_email="googleapis-packages@google.com",
83-
license="Apache 2.0",
84-
url="https://github.com/googleapis/python-api-core",
85-
classifiers=[
86-
release_status,
87-
"Intended Audience :: Developers",
88-
"License :: OSI Approved :: Apache Software License",
89-
"Programming Language :: Python",
90-
"Programming Language :: Python :: 3",
91-
"Programming Language :: Python :: 3.7",
92-
"Programming Language :: Python :: 3.8",
93-
"Programming Language :: Python :: 3.9",
94-
"Programming Language :: Python :: 3.10",
95-
"Programming Language :: Python :: 3.11",
96-
"Programming Language :: Python :: 3.12",
97-
"Programming Language :: Python :: 3.13",
98-
"Operating System :: OS Independent",
99-
"Topic :: Internet",
100-
],
101-
platforms="Posix; MacOS X; Windows",
102-
packages=packages,
103-
install_requires=dependencies,
104-
extras_require=extras,
105-
python_requires=">=3.7",
106-
include_package_data=True,
107-
zip_safe=False,
108-
)
18+
setuptools.setup()

0 commit comments

Comments
 (0)
Please sign in to comment.