Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 014e951

Browse filesBrowse files
authored
feat(logging): drop support for Python 3.7, 3.8, and 3.9 runtimes (#17276)
This PR updates the `google-cloud-logging` library to drop support for end-of-life Python runtimes (3.7, 3.8, and 3.9) and modernize package metadata and dependency constraints for Python 3.10+. ### Changes * **Librarian Config**: Edited setup.py replacement in `.librarian/generator-input/client-post-processing/logging-integration.yaml` and added post-processing injection rules for `testing/constraints-3.10.txt`. * **Regeneration**: Re-compiled GAPIC client services cleanly using `gapic-generator v1.33.0`, natively incorporating the `set_event_loop` autouse asyncio loop fixture inside all service unit tests. * **Codebase EOL Cleanup**: Removed obsolete warning filters from `pytest.ini` and EOL skips from `test_logger.py` and `CONTRIBUTING.rst`. 🦕
1 parent 58df2da commit 014e951
Copy full SHA for 014e951

12 files changed

+698-703Lines changed: 698 additions & 703 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.librarian/generator-input/client-post-processing/logging-integration.yaml‎

Copy file name to clipboardExpand all lines: .librarian/generator-input/client-post-processing/logging-integration.yaml
+18-3Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,30 @@ replacements:
3838
]
3939
before: |
4040
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
41-
\ "grpcio >= 1.44.0, < 2.0.0",
41+
"grpcio >= 1.59.0, < 2.0.0",
4242
after: |
4343
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
4444
"google-cloud-appengine-logging>=0.1.3, <2.0.0",
4545
"google-cloud-audit-log >= 0.3.1, < 1.0.0",
4646
"google-cloud-core >= 2.0.0, <3.0.0",
4747
"grpc-google-iam-v1 >=0.12.4, <1.0.0",
48-
"opentelemetry-api >= 1.9.0",
49-
"grpcio >= 1.44.0, < 2.0.0",
48+
"opentelemetry-api >= 1.16.0",
49+
"grpcio >= 1.59.0, < 2.0.0",
50+
count: 1
51+
- paths: [
52+
"packages/google-cloud-logging/testing/constraints-3.10.txt"
53+
]
54+
before: |
55+
google-auth==2.14.1
56+
grpcio==1.59.0
57+
after: |
58+
google-auth==2.14.1
59+
google-cloud-appengine-logging==0.1.3
60+
google-cloud-audit-log==0.3.1
61+
google-cloud-core==2.0.0
62+
grpc-google-iam-v1==0.12.4
63+
opentelemetry-api==1.16.0
64+
grpcio==1.59.0
5065
count: 1
5166
- paths: [
5267
"packages/google-cloud-logging/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py",
Collapse file

‎packages/google-cloud-logging/CONTRIBUTING.rst‎

Copy file name to clipboardExpand all lines: packages/google-cloud-logging/CONTRIBUTING.rst
+4-20Lines changed: 4 additions & 20 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to add a feature:
2222
documentation.
2323

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

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -195,11 +195,11 @@ configure them just like the System Tests.
195195

196196
# Run all tests in a folder
197197
$ cd samples/snippets
198-
$ nox -s py-3.8
198+
$ nox -s py-3.10
199199

200200
# Run a single sample test
201201
$ cd samples/snippets
202-
$ nox -s py-3.8 -- -k <name of test>
202+
$ nox -s py-3.10 -- -k <name of test>
203203

204204
********************************************
205205
Note About ``README`` as it pertains to PyPI
@@ -221,18 +221,12 @@ Supported Python Versions
221221

222222
We support:
223223

224-
- `Python 3.7`_
225-
- `Python 3.8`_
226-
- `Python 3.9`_
227224
- `Python 3.10`_
228225
- `Python 3.11`_
229226
- `Python 3.12`_
230227
- `Python 3.13`_
231228
- `Python 3.14`_
232229

233-
.. _Python 3.7: https://docs.python.org/3.7/
234-
.. _Python 3.8: https://docs.python.org/3.8/
235-
.. _Python 3.9: https://docs.python.org/3.9/
236230
.. _Python 3.10: https://docs.python.org/3.10/
237231
.. _Python 3.11: https://docs.python.org/3.11/
238232
.. _Python 3.12: https://docs.python.org/3.12/
@@ -245,17 +239,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
245239
.. _config: https://github.com/googleapis/google-cloud-python/blob/main/noxfile.py
246240

247241

248-
We also explicitly decided to support Python 3 beginning with version 3.7.
249-
Reasons for this include:
250-
251-
- Encouraging use of newest versions of Python 3
252-
- Taking the lead of `prominent`_ open-source `projects`_
253-
- `Unicode literal support`_ which allows for a cleaner codebase that
254-
works in both Python 2 and Python 3
255-
256-
.. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django
257-
.. _projects: http://flask.pocoo.org/docs/0.10/python3/
258-
.. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/
242+
We also explicitly decided to support Python 3 beginning with version 3.10.
259243

260244
**********
261245
Versioning
Collapse file
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
google-api-core==2.17.1
2+
google-auth==2.14.1
3+
google-cloud-appengine-logging==0.1.3
4+
google-cloud-audit-log==0.3.1
5+
google-cloud-core==2.0.0
6+
grpc-google-iam-v1==0.12.4
7+
grpcio==1.59.0
8+
grpcio==1.75.1
9+
opentelemetry-api==1.16.0
10+
proto-plus==1.22.3
11+
proto-plus==1.25.0
12+
protobuf==4.25.8
Collapse file

‎packages/google-cloud-logging/google/cloud/logging_v2/client.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-logging/google/cloud/logging_v2/client.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ def get_default_handler(self, **kw):
383383
elif monitored_resource.type == _GKE_RESOURCE_TYPE:
384384
return StructuredLogHandler(**kw, project_id=self.project)
385385
elif monitored_resource.type == _GCF_RESOURCE_TYPE:
386-
# __stdout__ stream required to support structured logging on Python 3.7
386+
# Bypassing redirects via __stdout__ ensures structured logging
387+
# works robustly on Google Cloud Functions even if stdout is redirected.
387388
kw["stream"] = kw.get("stream", sys.__stdout__)
388389
return StructuredLogHandler(**kw, project_id=self.project)
389390
elif monitored_resource.type == _RUN_RESOURCE_TYPE:
Collapse file

‎packages/google-cloud-logging/noxfile.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-logging/noxfile.py
+6-17Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@
4747

4848
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
4949

50-
LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt"
50+
if (CURRENT_DIRECTORY / "testing").exists():
51+
LOWER_BOUND_CONSTRAINTS_FILE = (
52+
CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt"
53+
)
54+
else:
55+
LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt"
5156
PACKAGE_NAME = "google-cloud-logging"
5257

5358
UNIT_TEST_STANDARD_DEPENDENCIES = [
@@ -466,14 +471,6 @@ def prerelease_deps(session, protobuf_implementation):
466471
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
467472
session.install(*unit_deps_all)
468473

469-
# Install dependencies for the system test environment
470-
system_deps_all = (
471-
SYSTEM_TEST_STANDARD_DEPENDENCIES
472-
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
473-
+ SYSTEM_TEST_EXTRAS
474-
)
475-
session.install(*system_deps_all)
476-
477474
# Because we test minimum dependency versions on the minimum Python
478475
# version, the first version we test with in the unit tests sessions has a
479476
# constraints file containing all dependencies and extras.
@@ -585,14 +582,6 @@ def core_deps_from_source(session, protobuf_implementation):
585582
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
586583
session.install(*unit_deps_all)
587584

588-
# Install dependencies for the system test environment
589-
system_deps_all = (
590-
SYSTEM_TEST_STANDARD_DEPENDENCIES
591-
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
592-
+ SYSTEM_TEST_EXTRAS
593-
)
594-
session.install(*system_deps_all)
595-
596585
# Because we test minimum dependency versions on the minimum Python
597586
# version, the first version we test with in the unit tests sessions has a
598587
# constraints file containing all dependencies and extras.
Collapse file

‎packages/google-cloud-logging/pytest.ini‎

Copy file name to clipboardExpand all lines: packages/google-cloud-logging/pytest.ini
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ filterwarnings =
1313
ignore:get_mtls_endpoint_and_cert_source is deprecated.:DeprecationWarning
1414
# DeprecationWarnings triggered by Flask 1.0 testing by Flask dependencies in test code
1515
ignore:Importing 'itsdangerous.json' is deprecated and will be removed in ItsDangerous 2.1:DeprecationWarning
16-
# 3.7 deprecation warnings, remove after support for Python 3.7 is dropped
17-
ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning
18-
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working:DeprecationWarning
19-
ignore:You are using a non-supported Python version \(3\.7:FutureWarning
20-
# 3.8 deprecation warnings, remove after support for Python 3.8 is dropped
21-
ignore:You are using a non-supported Python version \(3\.8:FutureWarning
22-
# 3.9 deprecation warnings, remove after support for Python 3.9 is dropped
23-
ignore:You are using a Python version \(3\.9:FutureWarning
2416
# 3.10 deprecation warnings, remove after support for Python 3.10 is dropped
2517
ignore:You are using a Python version \(3\.10:FutureWarning
2618
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working:DeprecationWarning
Collapse file

‎packages/google-cloud-logging/setup.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-logging/setup.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
"google-cloud-audit-log >= 0.3.1, < 1.0.0",
4848
"google-cloud-core >= 2.0.0, <3.0.0",
4949
"grpc-google-iam-v1 >=0.12.4, <1.0.0",
50-
"opentelemetry-api >= 1.9.0",
51-
"grpcio >= 1.44.0, < 2.0.0",
50+
"opentelemetry-api >= 1.16.0",
51+
"grpcio >= 1.59.0, < 2.0.0",
5252
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
5353
"proto-plus >= 1.22.3, <2.0.0",
5454
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",
Collapse file

‎packages/google-cloud-logging/testing/constraints-3.10.txt‎

Copy file name to clipboardExpand all lines: packages/google-cloud-logging/testing/constraints-3.10.txt
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
# then this file should have google-cloud-foo==1.14.0
77
google-api-core==2.17.1
88
google-auth==2.14.1
9-
grpcio==1.44.0
9+
google-cloud-appengine-logging==0.1.3
10+
google-cloud-audit-log==0.3.1
11+
google-cloud-core==2.0.0
12+
grpc-google-iam-v1==0.12.4
13+
opentelemetry-api==1.16.0
14+
grpcio==1.59.0
1015
proto-plus==1.22.3
1116
protobuf==4.25.8

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.