Repository navigation
feat(documentai-toolbox): drop Python 3.10 support - #19128
Conversation
There was a problem hiding this comment.
Code Review
This pull request drops support for Python 3.10, updating the minimum required version to Python 3.11 across setup configurations, documentation, and Nox test sessions, while also updating dependency bounds for google-cloud-storage and Pillow. The review feedback suggests keeping and updating the runtime Python version check to warn users on Python < 3.11 rather than removing it entirely. Additionally, it is recommended to keep the lower bound of Pillow at >=10.0.0 to avoid unnecessarily dropping support for older compatible versions, and to update the corresponding testing constraints file accordingly.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/google-cloud-documentai-toolbox/setup.py (71)
Bumping the lower bound of Pillow to >=13.0.0 will prevent installation of the package because Pillow 13.0.0 is not yet released (or is extremely new), and it unnecessarily drops support for widely used older versions of Pillow (like 10.x and 11.x) that are compatible with Python 3.11+. You likely meant to expand the upper bound while keeping the lower bound at 10.0.0.
"Pillow>=10.0.0, <14.0.0",
packages/google-cloud-documentai-toolbox/testing/constraints-3.11.txt (21)
Since the lower bound of Pillow in setup.py should remain 10.0.0, the constraints file should pin Pillow to 10.0.0 to correctly test the lower bounds.
Pillow==10.0.0
packages/google-cloud-documentai-toolbox/google/cloud/documentai_toolbox/init.py (38-45)
Instead of completely removing the runtime Python version check, it should be updated to warn users running Python < 3.11, since Python 3.10 support is being dropped in this PR. This ensures that users on unsupported Python versions are properly warned at runtime. Please also retain the import sys and import warnings statements at the top of the file. Additionally, ensure that the project's metadata in setup.py or pyproject.toml is updated to reflect the same minimum version in python_requires and Trove classifiers.
# Checks if the current runtime is Python < 3.11.
if sys.version_info < (3, 11): # pragma: NO COVER
message = (
"The google-cloud-documentai-toolbox library no longer supports Python 3.10. "
"We recommend that you update soon to ensure ongoing support. For "
"more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)"
)
warnings.warn(message, FutureWarning)
References
- When updating the minimum supported Python version in runtime checks (e.g., 'sys.version_info' checks), 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.
This PR drops support for the EOL Python3.10 version, and bumps up the dependency floor where needed
This PR drops support for the EOL Python3.10 version, and bumps up the dependency floor where needed