Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 8f4e3ce

Browse files
authored
fix: Add Python37DeprecationWarning (#241)
1 parent 37e5d68 commit 8f4e3ce

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

README.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ Python >= 3.7
6868
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
6969
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
7070

71+
**NOTE**:
72+
Python 3.7 was marked as `unsupported`_ by the python community in June 2023.
73+
We recommend that all developers upgrade to Python 3.8 and newer as soon as
74+
they can. Support for Python 3.7 will be removed from all client libraries after
75+
January 1 2024. Client libraries that support Python 3.7 will continue to be available
76+
for download, but releases after January 1 2024 will only target Python 3.8 and
77+
newer.
78+
79+
.. _unsupported: https://devguide.python.org/versions/#unsupported-versions
80+
7181
Unsupported Python Versions
7282
^^^^^^^^^^^^^^^^^^^^^^^^^^^
7383
Python <= 3.6

google/cloud/documentai_toolbox/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# limitations under the License.
1515
#
1616

17+
import sys
18+
import warnings
19+
1720
from google.cloud.documentai_toolbox import version as package_version
1821

1922
__version__ = package_version.__version__
@@ -23,3 +26,19 @@
2326
from .wrappers import document, entity, page
2427

2528
__all__ = (document, page, entity, converter, docai_utilities, gcs_utilities)
29+
30+
31+
class Python37DeprecationWarning(DeprecationWarning): # pragma: NO COVER
32+
"""
33+
Deprecation warning raised when Python 3.7 runtime is detected.
34+
Python 3.7 support will be dropped after January 1, 2024.
35+
"""
36+
37+
38+
# Checks if the current runtime is Python 3.7.
39+
if sys.version_info.major == 3 and sys.version_info.minor == 7: # pragma: NO COVER
40+
message = (
41+
"After January 1, 2024, new releases of this library will drop support "
42+
"for Python 3.7."
43+
)
44+
warnings.warn(message, Python37DeprecationWarning)

0 commit comments

Comments
 (0)