Skip to content

Commit e633e96

Browse files
authored
SNOW-1878542: Enable python 3.12 (#2852)
1 parent 2f06485 commit e633e96

File tree

7 files changed

+83
-23
lines changed

7 files changed

+83
-23
lines changed

.github/workflows/daily_precommit.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
download_name: macos
9999
- image_name: windows-latest-64-cores
100100
download_name: windows
101-
python-version: ["3.8", "3.9", "3.10", "3.11"]
101+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
102102
cloud-provider: [aws, azure, gcp]
103103
steps:
104104
- name: Checkout Code
@@ -145,14 +145,25 @@ jobs:
145145
# Specify SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1 when adding >= python3.12 with no server-side support
146146
# For example, see https://github.com/snowflakedb/snowpark-python/pull/681
147147
shell: bash
148-
- name: Run tests (excluding doctests)
148+
- if: ${{ matrix.python-version != '3.12' }}
149+
name: Run tests (excluding doctests)
149150
run: python -m tox -e "py${PYTHON_VERSION/\./}-dailynotdoctest-ci"
150151
env:
151152
PYTHON_VERSION: ${{ matrix.python-version }}
152153
cloud_provider: ${{ matrix.cloud-provider }}
153154
PYTEST_ADDOPTS: --color=yes --tb=short
154155
TOX_PARALLEL_NO_SPINNER: 1
155156
shell: bash
157+
- if: ${{ matrix.python-version == '3.12' }}
158+
name: Run tests (excluding doctests and udf tests)
159+
run: python -m tox -e "py${PYTHON_VERSION/\./}-dailynotdoctestnotudf-ci"
160+
env:
161+
PYTHON_VERSION: ${{ matrix.python-version }}
162+
cloud_provider: ${{ matrix.cloud-provider }}
163+
PYTEST_ADDOPTS: --color=yes --tb=short
164+
TOX_PARALLEL_NO_SPINNER: 1
165+
SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1
166+
shell: bash
156167
- name: Combine coverages
157168
run: python -m tox -e coverage --skip-missing-interpreters false
158169
shell: bash
@@ -217,7 +228,7 @@ jobs:
217228
os:
218229
- image_name: macos-latest
219230
download_name: macos # it includes doctest
220-
python-version: ["3.8", "3.9", "3.10", "3.11"]
231+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
221232
cloud-provider: [aws]
222233
steps:
223234
- name: Checkout Code
@@ -258,14 +269,25 @@ jobs:
258269
PYTEST_ADDOPTS: --color=yes --tb=short --disable_sql_simplifier
259270
TOX_PARALLEL_NO_SPINNER: 1
260271
shell: bash
261-
- name: Run tests (excluding doctests)
272+
- if: ${{ matrix.python-version != '3.12' }}
273+
name: Run tests (excluding doctests)
262274
run: python -m tox -e "py${PYTHON_VERSION/\./}-dailynotdoctest-ci"
263275
env:
264276
PYTHON_VERSION: ${{ matrix.python-version }}
265277
cloud_provider: ${{ matrix.cloud-provider }}
266278
PYTEST_ADDOPTS: --color=yes --tb=short --disable_sql_simplifier
267279
TOX_PARALLEL_NO_SPINNER: 1
268280
shell: bash
281+
- if: ${{ matrix.python-version == '3.12' }}
282+
name: Run tests (excluding doctests and udf tests)
283+
run: python -m tox -e "py${PYTHON_VERSION/\./}-dailynotdoctestnotudf-ci"
284+
env:
285+
PYTHON_VERSION: ${{ matrix.python-version }}
286+
cloud_provider: ${{ matrix.cloud-provider }}
287+
PYTEST_ADDOPTS: --color=yes --tb=short --disable_sql_simplifier
288+
TOX_PARALLEL_NO_SPINNER: 1
289+
SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1
290+
shell: bash
269291
- name: Combine coverages
270292
run: python -m tox -e coverage --skip-missing-interpreters false
271293
shell: bash
@@ -354,7 +376,7 @@ jobs:
354376
os:
355377
- image_name: macos-latest
356378
download_name: macos # it includes doctest
357-
python-version: ["3.8", "3.9", "3.10", "3.11"]
379+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
358380
cloud-provider: [aws]
359381
steps:
360382
- name: Checkout Code
@@ -484,7 +506,7 @@ jobs:
484506
os:
485507
- image_name: macos-latest
486508
download_name: macos # it includes doctest
487-
python-version: ["3.8", "3.9", "3.10", "3.11"]
509+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
488510
cloud-provider: [aws]
489511
steps:
490512
- name: Checkout Code
@@ -525,14 +547,23 @@ jobs:
525547
PYTEST_ADDOPTS: --color=yes --tb=short --disable_cte_optimization
526548
TOX_PARALLEL_NO_SPINNER: 1
527549
shell: bash
528-
- name: Run tests (excluding doctests)
550+
- if: ${{ matrix.python-version != '3.12' }}
551+
name: Run tests (excluding doctests)
529552
run: python -m tox -e "py${PYTHON_VERSION/\./}-dailynotdoctest-ci"
530553
env:
531554
PYTHON_VERSION: ${{ matrix.python-version }}
532555
cloud_provider: ${{ matrix.cloud-provider }}
533556
PYTEST_ADDOPTS: --color=yes --tb=short --disable_cte_optimization
534557
TOX_PARALLEL_NO_SPINNER: 1
535558
shell: bash
559+
- if: ${{ matrix.python-version == '3.12' }}
560+
name: Run tests (excluding doctests and udf tests)
561+
env:
562+
PYTHON_VERSION: ${{ matrix.python-version }}
563+
cloud_provider: ${{ matrix.cloud-provider }}
564+
PYTEST_ADDOPTS: --color=yes --tb=short --disable_cte_optimization
565+
TOX_PARALLEL_NO_SPINNER: 1
566+
shell: bash
536567
- name: Combine coverages
537568
run: python -m tox -e coverage --skip-missing-interpreters false
538569
shell: bash

.github/workflows/precommit.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
fail-fast: false
9595
matrix:
9696
os: [macos-latest, windows-latest-64-cores, ubuntu-latest-64-cores]
97-
python-version: ["3.9", "3.10", "3.11"]
97+
python-version: ["3.9", "3.10", "3.11", "3.12"]
9898
cloud-provider: [aws, gcp, azure]
9999
exclude:
100100
# only run macos with aws py3.9 for doctest
@@ -169,19 +169,19 @@ jobs:
169169
- name: Install tox
170170
run: python -m pip install tox
171171
# we only run doctest on macos
172-
- if: ${{ matrix.os == 'macos-latest' }}
172+
- if: ${{ matrix.os == 'macos-latest' && matrix.python-version != '3.12'}}
173173
name: Run doctests
174174
run: python -m tox -e "py${PYTHON_VERSION}-doctest-notudf-ci"
175175
env:
176176
PYTHON_VERSION: ${{ matrix.python-version }}
177177
cloud_provider: ${{ matrix.cloud-provider }}
178178
PYTEST_ADDOPTS: --color=yes --tb=short
179179
TOX_PARALLEL_NO_SPINNER: 1
180-
# Specify SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1 when adding >= python3.12 with no server-side support
180+
# Specify SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1 when adding >= python3.13 with no server-side support
181181
# For example, see https://github.com/snowflakedb/snowpark-python/pull/681
182182
shell: bash
183183
# do not run other tests for macos
184-
- if: ${{ matrix.os != 'macos-latest' }}
184+
- if: ${{ matrix.os != 'macos-latest' && matrix.python-version != '3.12' }}
185185
name: Run tests (excluding doctests)
186186
run: python -m tox -e "py${PYTHON_VERSION/\./}-notdoctest-ci"
187187
env:
@@ -190,6 +190,16 @@ jobs:
190190
PYTEST_ADDOPTS: --color=yes --tb=short
191191
TOX_PARALLEL_NO_SPINNER: 1
192192
shell: bash
193+
- if: ${{ matrix.python-version == '3.12' }}
194+
name: Run tests (excluding doctests and udf tests)
195+
run: python -m tox -e "py${PYTHON_VERSION/\./}-notudfdoctest-ci"
196+
env:
197+
PYTHON_VERSION: ${{ matrix.python-version }}
198+
cloud_provider: ${{ matrix.cloud-provider }}
199+
PYTEST_ADDOPTS: --color=yes --tb=short
200+
TOX_PARALLEL_NO_SPINNER: 1
201+
SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1
202+
shell: bash
193203
- name: Combine coverages
194204
run: python -m tox -e coverage --skip-missing-interpreters false
195205
shell: bash
@@ -211,7 +221,7 @@ jobs:
211221
fail-fast: false
212222
matrix:
213223
os: [macos-latest, windows-latest, ubuntu-latest]
214-
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
224+
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
215225
cloud-provider: [aws]
216226
steps:
217227
- name: Checkout Code
@@ -402,7 +412,7 @@ jobs:
402412
fail-fast: false
403413
matrix:
404414
os: [ ubuntu-latest ]
405-
python-version: [ "3.9", "3.11" ]
415+
python-version: [ "3.9", "3.11", "3.12" ]
406416
cloud-provider: [ aws ]
407417
steps:
408418
- name: Checkout Code
@@ -434,14 +444,25 @@ jobs:
434444
run: python -m pip install -U setuptools pip wheel
435445
- name: Install tox
436446
run: python -m pip install tox
437-
- name: Run tests for AST (II/II)
447+
- if: ${{ matrix.python-version != '3.12' }}
448+
name: Run tests for AST (II/II)
438449
run: python -m tox -e "py${PYTHON_VERSION/\./}-notdoctest-ci"
439450
env:
440451
PYTHON_VERSION: ${{ matrix.python-version }}
441452
cloud_provider: ${{ matrix.cloud-provider }}
442453
PYTEST_ADDOPTS: --color=yes --tb=short --enable_ast
443454
TOX_PARALLEL_NO_SPINNER: 1
444455
shell: bash
456+
- if: ${{ matrix.python-version == '3.12' }}
457+
name: Run tests for AST (II/II) (excluding udf tests)
458+
run: python -m tox -e "py${PYTHON_VERSION/\./}-notudfdoctest-ci"
459+
env:
460+
PYTHON_VERSION: ${{ matrix.python-version }}
461+
cloud_provider: ${{ matrix.cloud-provider }}
462+
PYTEST_ADDOPTS: --color=yes --tb=short --enable_ast
463+
TOX_PARALLEL_NO_SPINNER: 1
464+
SNOWFLAKE_IS_PYTHON_RUNTIME_TEST: 1
465+
shell: bash
445466
- name: Combine coverages
446467
run: python -m tox -e coverage --skip-missing-interpreters false
447468
shell: bash

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"tzlocal", # Snowpark IR
3232
"snowflake.core>=1.0.0, <2", # Catalog
3333
]
34-
REQUIRED_PYTHON_VERSION = ">=3.8, <3.12"
34+
REQUIRED_PYTHON_VERSION = ">=3.8, <3.13"
3535

3636
if os.getenv("SNOWFLAKE_IS_PYTHON_RUNTIME_TEST", False):
3737
REQUIRED_PYTHON_VERSION = ">=3.8"
@@ -228,6 +228,7 @@ def run(self):
228228
"Programming Language :: Python :: 3.9",
229229
"Programming Language :: Python :: 3.10",
230230
"Programming Language :: Python :: 3.11",
231+
"Programming Language :: Python :: 3.12",
231232
"Topic :: Database",
232233
"Topic :: Software Development",
233234
"Topic :: Software Development :: Libraries",

tests/integ/scala/test_async_job_suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ def test_async_job_to_df(session, create_async_job_from_query_id):
474474

475475

476476
def test_async_job_result_wait_no_result(session):
477-
async_job = session.sql("select system$wait(3)").collect_nowait()
478477
t0 = time()
478+
async_job = session.sql("select system$wait(3)").collect_nowait()
479479
result = async_job.result("no_result")
480480
t1 = time()
481481
assert t1 - t0 >= 3.0

tests/integ/test_dataframe.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4272,9 +4272,14 @@ def test_create_empty_dataframe(session):
42724272
def test_dataframe_to_local_iterator_with_to_pandas_isolation(
42734273
session, local_testing_mode
42744274
):
4275-
df = session.create_dataframe(
4276-
[["xyz", int("1" * 19)] for _ in range(200000)], schema=["a1", "b1"]
4277-
)
4275+
if local_testing_mode:
4276+
df = session.create_dataframe(
4277+
[["xyz", int("1" * 19)] for _ in range(200000)], schema=["a1", "b1"]
4278+
)
4279+
else:
4280+
df = session.sql(
4281+
"select 'xyz' as A1, 1111111111111111111 as B1 from table(generator(rowCount => 200000))"
4282+
)
42784283
trigger_df = session.create_dataframe(
42794284
[[1.0]], schema=StructType([StructField("A", DecimalType())])
42804285
)

tests/integ/test_packaging.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ def check_if_package_works() -> str:
599599
)
600600

601601

602+
@pytest.mark.udf
602603
@pytest.mark.skipif(
603604
IS_IN_STORED_PROC,
604605
reason="Subprocess calls are not allowed within stored procedures.",
@@ -609,7 +610,7 @@ def test_add_packages_with_native_dependency_without_force_push(session):
609610
with pytest.raises(
610611
RuntimeError, match="Your code depends on packages that contain native code"
611612
):
612-
session.add_packages(["catboost==1.2"])
613+
session.add_packages(["catboost==1.2.3"])
613614

614615

615616
@pytest.fixture(scope="function")
@@ -625,7 +626,7 @@ def requirements_file_with_local_path():
625626

626627
# Generate a requirements file
627628
requirements = f"""
628-
pyyaml==6.0
629+
pyyaml==6.0.2
629630
matplotlib
630631
{new_path}
631632
"""
@@ -657,7 +658,7 @@ def test_add_requirements_with_local_filepath(
657658
session.add_requirements(requirements_file_with_local_path)
658659
assert session.get_packages() == {
659660
"matplotlib": "matplotlib",
660-
"pyyaml": "pyyaml==6.0",
661+
"pyyaml": "pyyaml==6.0.2",
661662
}
662663

663664
udf_name = Utils.random_name_for_temp_object(TempObjectType.FUNCTION)

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ commands =
101101
notudfdoctest: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and not udf" {posargs:} tests
102102
local: {env:SNOWFLAKE_PYTEST_CMD} --local_testing_mode -m "integ or unit or mock" {posargs:} tests
103103
dailynotdoctest: {env:SNOWFLAKE_PYTEST_DAILY_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} or udf" {posargs:} tests
104+
dailynotdoctestnotudf: {env:SNOWFLAKE_PYTEST_DAILY_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and not udf" {posargs:} tests
104105
# Snowpark pandas commands:
105106
snowparkpandasnotdoctest: {env:MODIN_PYTEST_CMD} --durations=20 -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} {env:SNOW_1314507_WORKAROUND_RERUN_FLAGS} tests/unit/modin tests/integ/modin tests/integ/test_df_to_snowpark_pandas.py
106107
# This one only run doctest but we still need to include the tests folder to let tests/conftest.py to mark the doctest files for us
@@ -143,7 +144,7 @@ commands = coverage combine
143144
coverage report -m
144145
coverage xml -o {env:COV_REPORT_DIR:{toxworkdir}}/coverage.xml
145146
coverage html -d {env:COV_REPORT_DIR:{toxworkdir}}/htmlcov --show-contexts
146-
depends = py39, py310, py311
147+
depends = py39, py310, py311, py312
147148

148149
[testenv:docs]
149150
basepython = python3.9

0 commit comments

Comments
 (0)