Skip to content

Commit 3e64494

Browse files
fix cli for python 3.12 & 3.13 (#2311)
* fix cli for python 3.13 * revert 3.13 to 3.10 * update release notes * fix: [SNOW-2108648] revert upgrade of supported sf-snowpark-python * fix: [SNOW-2108648] revert upgrade of supported sf-snowpark-python
1 parent 3ef0747 commit 3e64494

File tree

11 files changed

+27
-13
lines changed

11 files changed

+27
-13
lines changed

.github/workflows/matrix.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
id: python
3131
run: |
3232
if [ "${{ github.event_name }}" = "schedule" ]; then
33-
echo 'python=["3.10", "3.11", "3.12"]' >> "$GITHUB_OUTPUT"
33+
echo 'python=["3.10", "3.11", "3.12", "3.13"]' >> "$GITHUB_OUTPUT"
3434
else
3535
# Last supported and most frequently used
3636
echo 'python=["3.10"]' >> "$GITHUB_OUTPUT"

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
## Fixes and improvements
2626
* Upgrade message is printed to stderr.
27+
* Fixed `snowflake.core` import issue on newer Python versions
2728

2829
# v3.8.0
2930

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040
"setuptools==80.3.1",
4141
"snowflake-connector-python[secure-local-storage]==3.15.0",
4242
'snowflake-snowpark-python>=1.15.0,<1.26.0;python_version < "3.12"',
43-
'snowflake.core==1.4.0; python_version < "3.12"',
43+
"snowflake.core==1.4.0",
4444
"tomlkit==0.13.2",
4545
"typer==0.15.2",
4646
"urllib3>=1.24.3,<2.5",
@@ -155,7 +155,7 @@ test_qa = [
155155
]
156156

157157
[[tool.hatch.envs.local.matrix]]
158-
python = ["3.10", "3.11", "3.12"]
158+
python = ["3.10", "3.11", "3.12", "3.13"]
159159

160160
[tool.coverage.run]
161161
source = ["snowflake.cli"]

snyk/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rich==14.0.0
1313
setuptools==80.3.1
1414
snowflake-connector-python[secure-local-storage]==3.15.0
1515
snowflake-snowpark-python>=1.15.0,<1.26.0;python_version < "3.12"
16-
snowflake.core==1.4.0; python_version < "3.12"
16+
snowflake.core==1.4.0
1717
tomlkit==0.13.2
1818
typer==0.15.2
1919
urllib3>=1.24.3,<2.5

tests/nativeapp/codegen/test_sandbox.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import pytest
2020
import snowflake.cli._plugins.nativeapp.codegen.sandbox as sandbox
2121

22-
from tests_common import IS_WINDOWS
22+
from tests_common import IS_WINDOWS, skip_snowpark_on_newest_python
2323

2424
PYTHON_SCRIPT = """
2525
import sys
@@ -825,6 +825,7 @@ def test_execute_does_not_interpret_return_codes(
825825
assert not mock_which.called
826826

827827

828+
@skip_snowpark_on_newest_python
828829
def test_sandbox_env_builder(temporary_directory):
829830
env_path = Path(temporary_directory) / "venv"
830831
builder = sandbox.SandboxEnvBuilder(env_path)

tests_common/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from snowflake.cli._plugins.streamlit.streamlit_entity_model import StreamlitEntityModel
2929
from snowflake.cli._plugins.workspace.context import WorkspaceContext, ActionContext
3030
from snowflake.cli.api.console.abc import AbstractConsole
31+
from snowflake.cli.api.constants import PYTHON_3_12
3132

3233
PROJECT_DIR = Path(__file__).parent / "test_data" / "projects"
3334

@@ -131,3 +132,9 @@ def _update(snowflake_yml_path: Path, parameter_path: str, value=None):
131132
yaml.safe_dump(yml, fh)
132133

133134
return _update
135+
136+
137+
skip_snowpark_on_newest_python = pytest.mark.skipif(
138+
sys.version_info >= PYTHON_3_12,
139+
reason="requires python3.11 or lower",
140+
)

tests_e2e/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import pytest
2424
from snowflake.cli import __about__
25+
from snowflake.cli.api.constants import PYTHON_3_12
2526
from snowflake.cli.api.secure_path import SecurePath
2627

2728
from tests_common import IS_WINDOWS
@@ -143,8 +144,8 @@ def _install_snowcli_with_external_plugin(
143144
/ "multilingual_hello_command_group",
144145
)
145146

146-
# Required by snowpark example tests
147-
_pip_install(python, "snowflake-snowpark-python[pandas]==1.25.0")
147+
if sys.version_info < PYTHON_3_12:
148+
_pip_install(python, "snowflake-snowpark-python[pandas]==1.25.0")
148149

149150

150151
def _python_path(venv_path: Path) -> Path:

tests_e2e/test_installation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
from pathlib import Path
1615

1716
import pytest
1817

18+
from tests_common import skip_snowpark_on_newest_python
1919
from tests_e2e.conftest import subprocess_check_output, subprocess_run
2020

2121

2222
@pytest.mark.e2e
23+
@skip_snowpark_on_newest_python
2324
def test_snow_help(snowcli, snapshot):
2425
output = subprocess_check_output([snowcli, "--help"])
2526
snapshot.assert_match(output)
2627

2728

2829
@pytest.mark.e2e
30+
@skip_snowpark_on_newest_python
2931
def test_snow_sql(snowcli, test_root_path, snapshot):
3032
output = subprocess_check_output(
3133
[

tests_e2e/test_nativeapp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import pytest
2121

22+
from tests_common import skip_snowpark_on_newest_python
2223
from tests_e2e.conftest import subprocess_check_output, subprocess_run
2324

2425

@@ -68,6 +69,7 @@ def assert_snapshot_match_with_query_result(output: str, snapshot) -> bool:
6869

6970

7071
@pytest.mark.e2e
72+
@skip_snowpark_on_newest_python
7173
def test_full_lifecycle_with_codegen(
7274
snowcli, test_root_path, project_directory, snapshot
7375
):

tests_integration/nativeapp/test_bundle.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
import os
1616
import os.path
1717

18-
import pytest
1918
import yaml
2019
from shlex import split
2120

2221
from tests.project.fixtures import *
22+
from tests_common import skip_snowpark_on_newest_python
2323
from tests_integration.testing_utils import (
2424
assert_that_result_failed_with_message_containing,
2525
)
@@ -344,6 +344,7 @@ def test_nativeapp_can_bundle_with_subdirs(
344344

345345

346346
@pytest.mark.integration
347+
@skip_snowpark_on_newest_python
347348
def test_nativeapp_bundle_subdirs_dont_overwrite(
348349
runner, nativeapp_teardown, setup_v2_project_w_subdir_w_snowpark
349350
):

0 commit comments

Comments
 (0)