Skip to content

Commit 1c0498b

Browse files
Upgade numpy and python version (#573)
* Upgade numpy version Signed-off-by: Nathalie Jonathan <[email protected]> * Upgrade python version Signed-off-by: Nathalie Jonathan <[email protected]> * Update changelog Signed-off-by: Nathalie Jonathan <[email protected]> * Fix failing tests Signed-off-by: Nathalie Jonathan <[email protected]> --------- Signed-off-by: Nathalie Jonathan <[email protected]>
1 parent e035653 commit 1c0498b

File tree

11 files changed

+23
-22
lines changed

11 files changed

+23
-22
lines changed

.ci/Dockerfile.client

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PYTHON_VERSION=3.9
1+
ARG PYTHON_VERSION=3.12
22
FROM python:${PYTHON_VERSION}
33

44
WORKDIR /code/opensearch-py-ml

.ci/run-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Default environment variables
66
export TEST_SUITE="${TEST_SUITE:=oss}"
7-
export PYTHON_VERSION="${PYTHON_VERSION:=3.9}"
7+
export PYTHON_VERSION="${PYTHON_VERSION:=3.12}"
88
export PANDAS_VERSION=${PANDAS_VERSION-1.5.0}
99
export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=Urllib3HttpConnection}"
1010
export CLUSTER="${1:-opensearch}"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
3434
- Update model upload history - opensearch-project/opensearch-semantic-highlighter-v1 (v.1.0.0)(TORCH_SCRIPT) by @nathaliellenaa ([#550](https://github.com/opensearch-project/opensearch-py-ml/pull/550))
3535
- Update pretrained_models_all_versions.json by @nathaliellenaa ([#560](https://github.com/opensearch-project/opensearch-py-ml/pull/560))
3636
- Upgrade torch version to fix security issue ([#561](https://github.com/opensearch-project/opensearch-py-ml/pull/561))
37+
- Upgrade numpy and python version ([#562](https://github.com/opensearch-project/opensearch-py-ml/pull/562))
3738

3839
### Fixed
3940
- Fix for uploading models with function_name instead of model_task ([#553](https://github.com/opensearch-project/opensearch-py-ml/pull/553))

DEVELOPER_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If you don't already have it installed (check with `git --version`) we recommend
4242

4343
#### Install `python`
4444

45-
You can install any version of python starting from 3.8.
45+
You can install any version of python starting from 3.11.
4646

4747
### Fork and clone OpenSearch-py-ml
4848

noxfile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def lint(session):
102102
# session.error("\n" + "\n".join(sorted(set(errors))))
103103

104104

105-
@nox.session(python=["3.8", "3.9", "3.10"])
105+
@nox.session(python=["3.11", "3.12", "3.13"])
106106
def test(session):
107107
session.install(
108108
"-r",
@@ -137,7 +137,7 @@ def test(session):
137137
)
138138

139139

140-
@nox.session(python=["3.9"])
140+
@nox.session(python=["3.12"])
141141
def docs(session):
142142
# Run this so users get an error if they don't have Pandoc installed.
143143
session.install("-r", "docs/requirements-docs.txt")
@@ -151,7 +151,7 @@ def docs(session):
151151
# While nox is typically used for automating testing, in this case, we utilize it
152152
# to automate the action workflow, leveraging its ability to set up the environment
153153
# required for model autotracing.
154-
@nox.session(python=["3.9"])
154+
@nox.session(python=["3.12"])
155155
def trace(session):
156156
session.install(
157157
"-r",
@@ -168,7 +168,7 @@ def trace(session):
168168
)
169169

170170

171-
@nox.session(python=["3.9"])
171+
@nox.session(python=["3.12"])
172172
def sparsetrace(session):
173173
session.install(
174174
"-r",
@@ -185,7 +185,7 @@ def sparsetrace(session):
185185
)
186186

187187

188-
@nox.session(python=["3.9"])
188+
@nox.session(python=["3.12"])
189189
def semantic_highlighter_trace(session):
190190
session.install(
191191
"-r",

opensearch_py_ml/field_mappings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def nan_value(self) -> Any:
132132
"""Returns NaN for any field except datetimes which use NaT"""
133133
if self.is_timestamp:
134134
return pd.NaT
135-
return np.float64(np.NaN)
135+
return np.float64(np.nan)
136136

137137

138138
class FieldMappings:

opensearch_py_ml/operations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def mode(
311311
if isinstance(values[0], pd.Timestamp):
312312
values.extend([pd.NaT] * row_diff)
313313
else:
314-
values.extend([np.NaN] * row_diff)
314+
values.extend([np.nan] * row_diff)
315315
pd_dict[key] = values
316316

317317
return pd.DataFrame(pd_dict)
@@ -666,7 +666,7 @@ def _unpack_metric_aggs(
666666

667667
# All of the below calculations result in NaN if count<=1
668668
if count <= 1:
669-
agg_value = np.NaN
669+
agg_value = np.nan
670670

671671
elif os_agg[1] == "std_deviation":
672672
agg_value *= count / (count - 1.0)
@@ -716,16 +716,16 @@ def _unpack_metric_aggs(
716716
agg_value is None or np.isnan(agg_value)
717717
):
718718
if is_dataframe_agg and not numeric_only:
719-
agg_value = np.NaN
719+
agg_value = np.nan
720720
elif not is_dataframe_agg and numeric_only is False:
721-
agg_value = np.NaN
721+
agg_value = np.nan
722722

723723
# Cardinality is always either NaN or integer.
724724
elif pd_agg in ("nunique", "count"):
725725
agg_value = (
726726
int(agg_value)
727727
if isinstance(agg_value, (int, float))
728-
else np.NaN
728+
else np.nan
729729
)
730730

731731
# If this is a non-null timestamp field convert to a pd.Timestamp()

opensearch_py_ml/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ def nunique(self) -> pd.Series:
16201620
16211621
>>> s = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights')['Carrier']
16221622
>>> s.nunique()
1623-
4
1623+
np.int64(4)
16241624
"""
16251625
results = super().nunique()
16261626
return results.squeeze()

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
pandas>=1.5.2,<2.3,!=2.1.0
55
matplotlib>=3.6.2,<4
6-
numpy>=1.24.0,<2
6+
numpy>=2.3.2
77
opensearch-py>=2.2.0
88
torch>=2.7.1-rc1
99
onnx>=1.15.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
pandas>=1.5.2,<2.3,!=2.1.0
55
matplotlib>=3.6.2,<4
6-
numpy>=1.24.0,<2
6+
numpy>=2.3.2
77
opensearch-py>=2.2.0
88
torch>=2.7.1-rc1
99
onnx>=1.15.0

0 commit comments

Comments
 (0)