feat(logging): [WIP] Drop support for Python 3.7, 3.8, 3.9#17249
feat(logging): [WIP] Drop support for Python 3.7, 3.8, 3.9#17249chalmerlowe wants to merge 30 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request drops support for Python 3.7, 3.8, and 3.9 across the google-cloud-logging package, updating configuration files, tests, and documentation to reflect Python 3.10 as the new minimum supported version. It also updates the lower-bound constraints checker in google-cloud-testutils to support environment marker evaluation based on the Python version parsed from the constraints filename. The review feedback highlights that evaluating markers with a partial environment dictionary (only containing python_version) can raise UndefinedEnvironmentName errors if other standard markers (like sys_platform or extra) are encountered. It is recommended to merge the parsed Python version with packaging.markers.default_environment() and wrap the evaluation in a try-except block to prevent crashes.
| # Pin pytest-asyncio to 0.23.8 to avoid strict event loop regressions | ||
| # in newer versions (v0.24+) which conflict with older grpcio (1.44.0) | ||
| # that does not automatically initialize loops in synchronous test threads. | ||
| "pytest-asyncio==0.23.8", |
There was a problem hiding this comment.
Let's bump grpcio instead if it's preventing us from using the latest pytest-asyncio. We can make this change in gapic-generator since this is an autogenerated file
There was a problem hiding this comment.
Bumped in the edit to the gapic-generator:
https://github.com/googleapis/google-cloud-python/pull/17260/changes
| LOWER_BOUND_CONSTRAINTS_FILE = ( | ||
| CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" | ||
| ) | ||
| count: 1 |
There was a problem hiding this comment.
This is an autogenerated file. If the change is needed, let's make it in gapic-generator instead and apply it throughout the SDK
There was a problem hiding this comment.
Change added to the gapic-generator:
https://github.com/googleapis/google-cloud-python/pull/17260/changes
| # | ||
| import logging as std_logging | ||
| import re | ||
| import uuid |
There was a problem hiding this comment.
These unused imports are being added back unexpectedly. The version of librarian used in #17235 is newer than the last release https://github.com/googleapis/librarian/releases/tag/v0.14.0. You can wait for 0.15.0, or use the same version of librarian in #17235
…in gapic-generator templates
| # See https://github.com/googleapis/google-cloud-python/issues/12364 | ||
| "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", | ||
| "grpcio >= 1.44.0, < 2.0.0", | ||
| "grpcio >= 1.59.0, < 2.0.0", |
There was a problem hiding this comment.
Let's split this into a separate PR so we can roll out the fix automatically across all libraries, including google-cloud-logging.
There was a problem hiding this comment.
… in gapic-generator templates
…emplates and integration goldens
…ldens with grpcio 1.59.0
…yncio loop RuntimeError in unit tests
…-rest constraints template
…vent loop fixture and async-rest constraints updates
…-3.14.txt and add pip freeze logger
…ale selective logging_internal golden snippets
…loop autouse fixture inside tests template
…plate to prevent Python 3.16 deprecation warnings
…fix-logging-FTL-1.33.0
… loops and version-proof post-processor
…nd sync constraints lower bounds
…e natively to prevent duplicates
…e to use minimal bookend anchors
…Error in generated tests
Warning
Do not merge. This is being reworked.
This PR updates python to establish version 3.10 as the minimum supported version.
Changes
Configuration & Dependencies:
setup.py,noxfile.py, andCONTRIBUTING.rstto require Python>= 3.10.opentelemetry-apito>= 1.16.0insetup.pyto drop the legacy dependency onpkg_resources, preventing runtime collection errors on modern Python runtimes.pytest-asyncio==0.23.8insidenoxfile.pyto bypass strict event loop regressions in newer versions (v0.24+) that conflict with synchronous gRPC client test setup.pytest.inito cleanly ignore Python 3.14asynciodeprecation warnings during preview test execution.Cleanup & Refactoring:
sys.version_inforuntime checks and compatibility reference comments for Python < 3.10 inclient.py.sys.__stdout__on Google Cloud Functions to clarify its defensive role on modern runtimes.Librarian Generator Post-Processing:
logging-integration.yamlpost-processing config to ensure future gapic-generator library runs automatically preserve these handwritten dependency boundaries, constraints paths, and version pins.