Skip to content

feat(logging): [WIP] Drop support for Python 3.7, 3.8, 3.9#17249

Draft
chalmerlowe wants to merge 30 commits into
mainfrom
feat/fix-logging-FTL-1.33.0
Draft

feat(logging): [WIP] Drop support for Python 3.7, 3.8, 3.9#17249
chalmerlowe wants to merge 30 commits into
mainfrom
feat/fix-logging-FTL-1.33.0

Conversation

@chalmerlowe
Copy link
Copy Markdown
Contributor

@chalmerlowe chalmerlowe commented May 26, 2026

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:

    • Updated the Python support matrix and classifiers across setup.py, noxfile.py, and CONTRIBUTING.rst to require Python >= 3.10.
    • Bumped the minimum version of opentelemetry-api to >= 1.16.0 in setup.py to drop the legacy dependency on pkg_resources, preventing runtime collection errors on modern Python runtimes.
    • Pinned pytest-asyncio==0.23.8 inside noxfile.py to bypass strict event loop regressions in newer versions (v0.24+) that conflict with synchronous gRPC client test setup.
    • Added warning filters in pytest.ini to cleanly ignore Python 3.14 asyncio deprecation warnings during preview test execution.
  • Cleanup & Refactoring:

    • Eradicated obsolete sys.version_info runtime checks and compatibility reference comments for Python < 3.10 in client.py.
    • Cleaned up obsolete test skips and mock redefinitions for EOL runtimes inside the test suite.
    • Refined comments surrounding the use of sys.__stdout__ on Google Cloud Functions to clarify its defensive role on modern runtimes.
  • Librarian Generator Post-Processing:

    • Integrated EOL replacement rules into the package's logging-integration.yaml post-processing config to ensure future gapic-generator library runs automatically preserve these handwritten dependency boundaries, constraints paths, and version pins.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/google-cloud-logging/testing/constraints-3.10.txt Outdated
@parthea parthea marked this pull request as ready for review May 26, 2026 14:21
@parthea parthea requested a review from a team as a code owner May 26, 2026 14:21
@parthea parthea self-assigned this May 26, 2026
# 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",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOWER_BOUND_CONSTRAINTS_FILE = (
CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt"
)
count: 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an autogenerated file. If the change is needed, let's make it in gapic-generator instead and apply it throughout the SDK

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#
import logging as std_logging
import re
import uuid
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@parthea parthea assigned chalmerlowe and unassigned parthea May 26, 2026
# 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",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's split this into a separate PR so we can roll out the fix automatically across all libraries, including google-cloud-logging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chalmerlowe chalmerlowe marked this pull request as draft May 26, 2026 15:14
@chalmerlowe chalmerlowe added this to the generate via 1.32.0 milestone May 27, 2026
@chalmerlowe chalmerlowe added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label May 27, 2026
@chalmerlowe chalmerlowe changed the title feat(logging): Drop support for Python 3.7, 3.8, 3.9 feat(logging): [WIP] Drop support for Python 3.7, 3.8, 3.9 May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants