Skip to content

Commit 4fb3b33

Browse files
[SNOW-1871355]: Move import of COMPATIBLE_WITH_MODIN for backwards compatibility (#2853)
<!--- Please answer these questions before creating your pull request. Thanks! ---> 1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR. <!--- In this section, please add a Snowflake Jira issue number. Note that if a corresponding GitHub issue exists, you should still include the Snowflake Jira issue number. For example, for GitHub issue #1400, you should add "SNOW-1335071" here. ---> Fixes SNOW-1871355 2. Fill out the following pre-review checklist: - [ ] I am adding a new automated test(s) to verify correctness of my new code - [ ] If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing - [ ] I am adding new logging messages - [ ] I am adding a new telemetry message - [ ] I am adding new credentials - [ ] I am adding a new dependency - [ ] If this is a new feature/behavior, I'm adding the Local Testing parity changes. - [x] I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: [Thread-safe Developer Guidelines](https://github.com/snowflakedb/snowpark-python/blob/main/CONTRIBUTING.md#thread-safe-development) 3. Please describe how your code solves the related issue. Having COMPATIBLE_WITH_MODIN defined in utils.py causes conftest to fail some stored procedure Snowfort tests when the version of snowpark-python imported by the stored procedure is older than the version of the tests being run (the tests files are cloned directly from GitHub and seem to pull the latest version, whereas some stored procedures are run in older python versions and have older versions of snowpark-python). Moving the definition of COMPATIBLE_WITH_MODIN into conftest avoids this issue and maintains backwards compatibility. The failure is because `COMPATIBLE_WITH_MODIN` is not defined in [snowflake/snowpark/_internal/utils.py](https://github.com/snowflakedb/snowpark-python/blob/release-v1.25.0/src/snowflake/snowpark/_internal/utils.py) for version 1.25.0 which is what the stored proc is running, since it is on python 3.8, and that's the latest version of snowpark-python available for 3.8. Co-authored-by: Jonathan Shi <[email protected]>
1 parent 1ed17cc commit 4fb3b33

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/snowflake/snowpark/_internal/utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import random
1919
import re
2020
import string
21-
import sys
2221
import threading
2322
import traceback
2423
import zipfile
@@ -1392,10 +1391,6 @@ def import_or_missing_modin_pandas() -> Tuple[ModuleLikeObject, bool]:
13921391
return MissingModin(), False
13931392

13941393

1395-
# Modin breaks Python 3.8 compatibility, do not test when running under 3.8.
1396-
COMPATIBLE_WITH_MODIN = sys.version_info.minor > 8
1397-
1398-
13991394
class GlobalCounter:
14001395
def __init__(self) -> None:
14011396
self._lock = threading.Lock()

tests/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import pytest
1313

14-
from snowflake.snowpark._internal.utils import COMPATIBLE_WITH_MODIN, warning_dict
14+
from snowflake.snowpark._internal.utils import warning_dict
1515
from .ast.conftest import default_unparser_path
1616

1717
logging.getLogger("snowflake.connector").setLevel(logging.ERROR)
@@ -20,6 +20,10 @@
2020
"accessor.py",
2121
]
2222

23+
# Modin breaks Python 3.8 compatibility, do not test when running under 3.8.
24+
COMPATIBLE_WITH_MODIN = sys.version_info.minor > 8
25+
26+
2327
# the fixture only works when opentelemetry is installed
2428
try:
2529
from opentelemetry import trace

0 commit comments

Comments
 (0)