Skip to content

Commit 8fa321e

Browse files
authored
fix(documentai-toolbox): Drop support for Python <= 3.9 (#16967)
This PR updates `google-cloud-documentai-toolbox` to establish Python 3.10 as the minimum supported version, dropping support for Python 3.9 and below. ### Changes * **Configuration**: Updated `setup.py` and `noxfile.py` to require Python 3.10+ and remove references to Python 3.9. Deleted `constraints-3.9.txt`. * **Documentation**: Updated `README.rst` and `CONTRIBUTING.rst` to require Python 3.10+ and remove references to Python 3.9. Synced the top-level `README.rst` to the `docs` folder. * **Cleanup**: Removed obsolete warning suppressions in `pytest.ini` related to Python 3.7 and 3.8. Updated the runtime version check in `__init__.py` to warn on versions older than 3.10. * **Dependency Fixes**: Resolved dependency conflicts on Python 3.10 by bumping the minimum version of `google-cloud-storage` to `2.0.0` in `setup.py` to avoid conflicts with `google-auth`. Added `setuptools==79.0.0` to `constraints-3.10.txt` to resolve the `ModuleNotFoundError: No module named 'pkg_resources'` and avoid its subsequent deprecation warning. Fixes internal issue: http://b/482126936 🦕
1 parent 98b9828 commit 8fa321e

9 files changed

Lines changed: 39 additions & 73 deletions

File tree

packages/google-cloud-documentai-toolbox/CONTRIBUTING.rst

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to add a feature:
2222
documentation.
2323

2424
- The feature must work fully on the following CPython versions:
25-
3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
25+
3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
2626

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -148,8 +148,6 @@ Running System Tests
148148

149149
.. note::
150150

151-
System tests are only configured to run under Python 3.9 and 3.14.
152-
For expediency, we do not run them in older versions of Python 3.
153151

154152
This alone will not run the tests. You'll need to change some local
155153
auth settings and change some configuration in your project to
@@ -197,14 +195,12 @@ Supported Python Versions
197195

198196
We support:
199197

200-
- `Python 3.9`_
201198
- `Python 3.10`_
202199
- `Python 3.11`_
203200
- `Python 3.12`_
204201
- `Python 3.13`_
205202
- `Python 3.14`_
206203

207-
.. _Python 3.9: https://docs.python.org/3.9/
208204
.. _Python 3.10: https://docs.python.org/3.10/
209205
.. _Python 3.11: https://docs.python.org/3.11/
210206
.. _Python 3.12: https://docs.python.org/3.12/
@@ -217,17 +213,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
217213
.. _config: https://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-documentai-toolbox/noxfile.py
218214

219215

220-
We also explicitly decided to support Python 3 beginning with version 3.9.
221-
Reasons for this include:
222216

223-
- Encouraging use of newest versions of Python 3
224-
- Taking the lead of `prominent`_ open-source `projects`_
225-
- `Unicode literal support`_ which allows for a cleaner codebase that
226-
works in both Python 2 and Python 3
227-
228-
.. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django
229-
.. _projects: http://flask.pocoo.org/docs/0.10/python3/
230-
.. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/
231217

232218
**********
233219
Versioning

packages/google-cloud-documentai-toolbox/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ Supported Python Versions
6363
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
6464
Python.
6565

66-
Python >= 3.9
66+
Python >= 3.10
6767

6868
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
6969
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
7070

7171
Unsupported Python Versions
7272
^^^^^^^^^^^^^^^^^^^^^^^^^^^
73-
Python <= 3.8
73+
Python <= 3.9
7474

7575
If you are using an `end-of-life`_
7676
version of Python, we recommend that you update as soon as possible to an actively supported version.

packages/google-cloud-documentai-toolbox/docs/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ Supported Python Versions
6363
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
6464
Python.
6565

66-
Python >= 3.9
66+
Python >= 3.10
6767

6868
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
6969
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
7070

7171
Unsupported Python Versions
7272
^^^^^^^^^^^^^^^^^^^^^^^^^^^
73-
Python <= 3.8
73+
Python <= 3.9
7474

7575
If you are using an `end-of-life`_
7676
version of Python, we recommend that you update as soon as possible to an actively supported version.

packages/google-cloud-documentai-toolbox/google/cloud/documentai_toolbox/__init__.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,11 @@
3535
)
3636

3737

38-
class Python37DeprecationWarning(DeprecationWarning): # pragma: NO COVER
39-
"""
40-
Deprecation warning raised when Python 3.7 runtime is detected.
41-
Python 3.7 support will be dropped after January 1, 2024.
42-
"""
43-
44-
45-
# Checks if the current runtime is Python 3.7.
46-
if sys.version_info.major == 3 and sys.version_info.minor == 7: # pragma: NO COVER
38+
# Checks if the current runtime is Python < 3.10.
39+
if sys.version_info < (3, 10): # pragma: NO COVER
4740
message = (
48-
"After January 1, 2024, new releases of this library will drop support "
49-
"for Python 3.7."
41+
"The google-cloud-documentai-toolbox library no longer supports Python 3.7, 3.8, and 3.9. "
42+
"We recommend that you update soon to ensure ongoing support. For "
43+
"more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)"
5044
)
51-
warnings.warn(message, Python37DeprecationWarning)
45+
warnings.warn(message, FutureWarning)

packages/google-cloud-documentai-toolbox/noxfile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
DEFAULT_PYTHON_VERSION = "3.14"
3737

3838
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
39-
"3.9",
4039
"3.10",
4140
"3.11",
4241
"3.12",
@@ -57,7 +56,7 @@
5756
UNIT_TEST_EXTRAS: List[str] = []
5857
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
5958

60-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.9", "3.14"]
59+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]
6160
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
6261
"mock",
6362
"pytest",
@@ -72,7 +71,6 @@
7271
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
7372

7473
nox.options.sessions = [
75-
"unit-3.9",
7674
"unit-3.10",
7775
"unit-3.11",
7876
"unit-3.12",

packages/google-cloud-documentai-toolbox/pytest.ini

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ filterwarnings =
66
ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning
77
# Remove once https://github.com/dateutil/dateutil/issues/1314 is fixed
88
ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning:dateutil.tz.tz
9-
# Remove once Python3.7 support is dropped https://github.com/googleapis/python-documentai-toolbox/issues/209
10-
ignore:distutils Version classes are deprecated:DeprecationWarning
11-
# Remove after support for Python 3.7 is dropped
12-
ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning
9+
1310
# Remove once the minimum supported version of `google-api-core` is 2.15.0
1411
ignore:.*pkg_resources.declare_namespace:DeprecationWarning
1512
ignore:.*pkg_resources is deprecated as an API:DeprecationWarning
16-
# Remove once the minimum supported Python runtime of this library is Python 3.9
17-
ignore:The python-bigquery library will stop supporting Python 3.7 and Python 3.8:PendingDeprecationWarning
13+
1814
# This error is expected for python versions that approach EOL
1915
ignore:.*Please upgrade to the latest Python version.*:FutureWarning
2016
ignore:(?s).*using a Python version.*past its end of life.*:FutureWarning

packages/google-cloud-documentai-toolbox/setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,20 @@
6262
"grpc-google-iam-v1>=0.12.6, <1.0.0",
6363
"google-cloud-bigquery>=3.14.0, <4.0.0",
6464
"google-cloud-documentai>=2.29.2, <4.0.0",
65-
"google-cloud-storage>=1.31.0, <4.0.0",
66-
"google-cloud-vision>=2.7.0, <4.0.0",
65+
"google-cloud-storage>=2.3.0, <4.0.0",
66+
"google-cloud-vision>=3.2.0, <4.0.0",
6767
"numpy>=1.23.5, <3.0.0",
6868
"intervaltree>=3.0.0",
6969
"pikepdf>=8.0.0, <11.0.0",
7070
"immutabledict>=2.0.0, <5.0.0",
7171
"Pillow>=10.0.0, <12.0.0",
7272
"Jinja2>=3.1.0, <4.0.0",
7373
),
74-
python_requires=">=3.9",
74+
python_requires=">=3.10",
7575
classifiers=[
7676
"Development Status :: 3 - Alpha",
7777
"Intended Audience :: Developers",
7878
"Operating System :: OS Independent",
79-
"Programming Language :: Python :: 3.9",
8079
"Programming Language :: Python :: 3.10",
8180
"Programming Language :: Python :: 3.11",
8281
"Programming Language :: Python :: 3.12",
Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
# -*- coding: utf-8 -*-
2-
# This constraints file is required for unit tests.
3-
# List all library dependencies and extras in this file.
4-
google-api-core
5-
pandas
6-
proto-plus
7-
grpc-google-iam-v1
8-
google-cloud-bigquery
9-
google-cloud-documentai
10-
google-cloud-storage
11-
numpy
12-
pikepdf
1+
# This constraints file is used to check that lower bounds
2+
# are correct in setup.py
3+
# List all library dependencies and extras in this file,
4+
# pinning their versions to their lower bounds.
5+
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
6+
# then this file should have google-cloud-foo==1.14.0
7+
google-api-core==2.15.0
8+
pandas==2.0.0
9+
pyarrow==15.0.0
10+
tabulate==0.9.0
11+
proto-plus==1.22.3
12+
grpc-google-iam-v1==0.12.6
13+
google-cloud-bigquery==3.14.0
14+
google-cloud-documentai==2.29.2
15+
google-cloud-storage==2.3.0
16+
google-cloud-vision==3.2.0
17+
numpy==1.23.5
18+
intervaltree==3.0.0
19+
pikepdf==8.0.0
20+
immutabledict==2.0.0
21+
Pillow==10.0.0
22+
Jinja2==3.1.0

packages/google-cloud-documentai-toolbox/testing/constraints-3.9.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)