Skip to content

Commit

Permalink
SNOW-986112: Fix numpy dependency issue (#1168)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-aling authored Dec 7, 2023
1 parent a09f5c7 commit 7813b7d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 1.11.1 (2023-11-07)

### Bug Fixes

- Fixed a bug that numpy should not be imported at the top level of mock module.

## 1.11.0 (2023-11-05)

### New Features
Expand Down
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "snowflake-snowpark-python" %}
{% set version = "1.11.0" %}
{% set version = "1.11.1" %}

package:
name: {{ name|lower }}
Expand Down
4 changes: 2 additions & 2 deletions src/snowflake/snowpark/mock/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from functools import cmp_to_key, partial
from typing import Any, Tuple

import numpy

from snowflake.connector.options import pandas as pd
from snowflake.snowpark.mock._snowflake_data_type import ColumnEmulator
from snowflake.snowpark.types import (
Expand Down Expand Up @@ -190,6 +188,8 @@ def process_string_time_with_fractional_seconds(time: str, fractional_seconds) -


def fix_drift_between_column_sf_type_and_dtype(col: ColumnEmulator):
import numpy

if (
isinstance(col.sf_type.datatype, _NumericType)
and col.apply(lambda x: x is None).any()
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/snowpark/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
#

# Update this for the versions
VERSION = (1, 11, 0)
VERSION = (1, 11, 1)
6 changes: 3 additions & 3 deletions tests/integ/test_udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
)

is_pandas_available = True
numpy_funcs = [numpy.min, numpy.sqrt, numpy.tan, numpy.sum, numpy.median]
except ImportError:
is_pandas_available = False
numpy_funcs = []

from typing import Dict, List, Optional, Union

Expand Down Expand Up @@ -2157,9 +2159,7 @@ def echo(num: int) -> int:
(not is_pandas_available) or IS_IN_STORED_PROC,
reason="numpy and pandas are required",
)
@pytest.mark.parametrize(
"func", [numpy.min, numpy.sqrt, numpy.tan, numpy.sum, numpy.median]
)
@pytest.mark.parametrize("func", numpy_funcs)
def test_numpy_udf(session, func):
numpy_udf = udf(
func, return_type=DoubleType(), input_types=[DoubleType()], packages=["numpy"]
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ deps =
pip >= 19.3.1
pytest-xdist
pytest-timeout
pyarrow
.[development]
commands = {env:SNOWFLAKE_PYTEST_CMD} -vvv -m "integ or unit" {posargs:} tests

Expand Down

0 comments on commit 7813b7d

Please sign in to comment.