feat(spanner): drop support for python 3.9#17043
Conversation
…boundaries for explicit_version_string
… to .scannerignore
There was a problem hiding this comment.
Code Review
This pull request drops support for Python 3.9 in the google-cloud-spanner package, updating metadata, documentation, and test configurations to reflect a new minimum requirement of Python 3.10. It also introduces a new version_scanner utility in scripts/ designed to identify hardcoded dependency versions across the repository. Review feedback suggests adding a constraints-3.10.txt file and ensuring a minor version bump for the breaking change. Additionally, improvements were recommended for the scanner tool, including fixing .scannerignore path resolution, supporting nested directory ignores, and documenting required external dependencies in the README.
| platforms="Posix; MacOS X; Windows", | ||
| packages=packages, | ||
| python_requires=">=3.9", | ||
| python_requires=">=3.10", |
There was a problem hiding this comment.
Since the minimum supported Python version is being updated to 3.10 and packages/google-cloud-spanner/testing/constraints-3.9.txt is being removed, a corresponding constraints-3.10.txt file should be added. This ensures that the lowest supported runtime has a dedicated constraints file with pins matching the lower bounds defined in setup.py. Furthermore, ensure that the project's metadata in setup.py (specifically python_requires and Trove classifiers) is updated to reflect this change. As dropping support for a Python version is a breaking change, please ensure a minor version bump is used for this release to maintain the ability to provide patches for the previous version.
References
- When updating the minimum supported Python version, ensure that the project's metadata in 'setup.py' or 'pyproject.toml' is also updated to reflect the same minimum version in 'python_requires' and Trove classifiers.
- When a release introduces breaking changes in environment requirements, such as dropping support for specific Python versions, prefer a minor version bump over a patch version bump.
| script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| ignore_file_path = os.path.join(script_dir, ".scannerignore") | ||
| ignore_dirs = load_ignore_file(ignore_file_path) |
There was a problem hiding this comment.
The code currently only looks for the .scannerignore file in the script's own directory (scripts/version_scanner/). However, the README (line 31) indicates that users should create this file in the directory being scanned (usually the repository root). This inconsistency means that an ignore file placed in the repo root will be ignored by the scanner.
| script_dir = os.path.dirname(os.path.abspath(__file__)) | |
| ignore_file_path = os.path.join(script_dir, ".scannerignore") | |
| ignore_dirs = load_ignore_file(ignore_file_path) | |
| ignore_dirs = load_ignore_file(os.path.join(args.path, ".scannerignore")) | |
| script_dir = os.path.dirname(os.path.abspath(__file__)) | |
| ignore_dirs.extend(load_ignore_file(os.path.join(script_dir, ".scannerignore"))) |
|
|
||
| for root, dirs, files in os.walk(root_path): | ||
| # Prune ignore directories (case-insensitive) | ||
| dirs[:] = [d for d in dirs if d.lower() not in ignore_lower] |
There was a problem hiding this comment.
The current implementation of directory ignoring only checks the base name of each directory against the ignore list. This prevents users from ignoring specific nested paths (e.g., packages/pkg_a/tests). Consider updating the logic to support path-based ignoring or glob patterns to provide more granular control.
| Run the script from the repository root: | ||
|
|
||
| ```bash | ||
| python3 scripts/version_scanner/version_scanner.py -d <dependency> -v <version> [options] | ||
| ``` |
There was a problem hiding this comment.
This PR updates
Pythonto establish version 3.10 as the minimum supported version.Changes
setup.pyandnoxfile.pyto require Python >=3.10 and remove references to older versions.Fixes internal issue: http://b/482126936 🦕