chore: librarian update image pull request: 20260326T182616Z#1786
chore: librarian update image pull request: 20260326T182616Z#1786
Conversation
…prod/images-prod/python-librarian-generator@sha256:234b9d1f2ddb057ed7ac6a38db0bf8163d839c65c6cf88ade52530cddebce59e
There was a problem hiding this comment.
Code Review
This pull request implements runtime Python and dependency version checks, refactors import styles for consistency, and updates project configurations including mypy.ini and dependency constraints. The review feedback suggests aligning the implementation with the project's Python 3.10+ support policy by removing legacy compatibility blocks for Python 3.7 and 3.9, and correcting the mypy target version to 3.10 to ensure compatibility across all supported environments.
| else: # pragma: NO COVER | ||
| # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove | ||
| # this code path once we drop support for Python 3.7 | ||
| import importlib_metadata as metadata |
There was a problem hiding this comment.
| if sys.version_info < (3, 9): | ||
| warnings.warn( | ||
| "You are using a non-supported Python version " | ||
| + f"({_py_version_str}). Google will not post any further " | ||
| + f"updates to {_package_label} supporting this Python version. " | ||
| + "Please upgrade to the latest Python version, or at " | ||
| + f"least to Python 3.9, and then update {_package_label}.", | ||
| FutureWarning, | ||
| ) | ||
| if sys.version_info[:2] == (3, 9): | ||
| warnings.warn( | ||
| f"You are using a Python version ({_py_version_str}) " | ||
| + f"which Google will stop supporting in {_package_label} in " | ||
| + "January 2026. Please " | ||
| + "upgrade to the latest Python version, or at " | ||
| + "least to Python 3.10, before then, and " | ||
| + f"then update {_package_label}.", | ||
| FutureWarning, | ||
| ) |
There was a problem hiding this comment.
The general rules state that the library only supports Python versions 3.10 and greater. This code block issues warnings for Python versions < 3.9 and Python 3.9, which are outside the supported range. These warnings are not necessary if the library strictly enforces Python 3.10+.
References
- The library only supports Python versions 3.10 and greater.
| except Exception: | ||
| warnings.warn( | ||
| "Could not determine the version of Python " | ||
| + "currently being used. To continue receiving " | ||
| + "updates for {_package_label}, ensure you are " | ||
| + "using a supported version of Python; see " | ||
| + "https://devguide.python.org/versions/" | ||
| ) |
There was a problem hiding this comment.
The general rules state that the library only supports Python versions 3.10 and greater. This except block handles cases where the Python version cannot be determined, but the warnings for older Python versions should ideally be removed if the library strictly enforces Python 3.10+.
References
- The library only supports Python versions 3.10 and greater.
| @@ -1,3 +1,15 @@ | |||
| [mypy] | |||
| python_version = 3.7 | |||
| python_version = 3.14 | |||
There was a problem hiding this comment.
The general rules state that the library only supports Python versions 3.10 and greater. Setting python_version = 3.14 in mypy.ini might lead to type-checking issues for Python 3.10-3.13. It's generally recommended to set this to the minimum supported Python version (3.10) to ensure compatibility across all supported versions, or to have separate configurations for each supported version.
References
- The library only supports Python versions 3.10 and greater.
feat: update image to us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:234b9d1f2ddb057ed7ac6a38db0bf8163d839c65c6cf88ade52530cddebce59e