Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#### Deprecations

- Deprecated warnings will be triggered when using snowpark-python with Python 3.9. For more details, please refer to https://docs.snowflake.com/en/developer-guide/python-runtime-support-policy.

#### Dependency Updates

#### Improvements
Expand Down
21 changes: 21 additions & 0 deletions src/snowflake/snowpark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,35 @@
"the Snowflake team. For more details, please refer "
"to https://docs.snowflake.com/en/developer-guide/python-runtime-support-policy."
)
_deprecation_warning_msg_for_3_9 = (
"Python Runtime 3.9 reached its End-Of-Life (EOL) in October 2025, there will be no further bug fixes "
"or security updates for this runtime. We recommend that you upgrade your existing Python 3.9 objects to "
"Python 3.10, 3.11, 3.12 or 3.13. Please note that end of support does not impact execution, "
"and you will still be able to update and invoke existing objects. "
"However, they will be running on an unsupported runtime which will no longer be maintained or patched by "
"the Snowflake team. For more details, please refer "
"to https://docs.snowflake.com/en/developer-guide/python-runtime-support-policy."
)

warnings.filterwarnings(
"once", # ensure the warning is only shown once to avoid warning explosion
message=_deprecation_warning_msg,
)
warnings.filterwarnings(
"once",
message=_deprecation_warning_msg_for_3_9,
)

if sys.version_info.major == 3 and sys.version_info.minor == 8:
warnings.warn(
_deprecation_warning_msg,
category=DeprecationWarning,
stacklevel=2,
)

if sys.version_info.major == 3 and sys.version_info.minor == 9:
warnings.warn(
_deprecation_warning_msg_for_3_9,
category=DeprecationWarning,
stacklevel=2,
)
18 changes: 18 additions & 0 deletions tests/unit/test_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,21 @@ def test_py38_deprecation():
with pytest.warns(None) as record:
importlib.import_module("snowflake.snowpark")
assert len(record) == 0


def test_py39_deprecation():
if not (sys.version_info.major == 3 and sys.version_info.minor == 9):
pytest.skip("This test is for Python 3.9 only")

with pytest.warns(
DeprecationWarning,
match="Python Runtime 3.9 reached its End-Of-Life",
) as record:
importlib.reload(snowflake.snowpark)

assert len(record) == 1

# import again won't trigger the warning
with pytest.warns(None) as record:
importlib.import_module("snowflake.snowpark")
assert len(record) == 0