From a9024717049459ec71be042f183790a8ab89ae31 Mon Sep 17 00:00:00 2001 From: "Fabio M. Graetz, Ph.D" Date: Mon, 17 Jun 2024 18:09:51 +0200 Subject: [PATCH] Fix: Fix deprecated numpy type and make numpy<2 explicit dependency (#2483) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Replace deprecated np.string_ with np.bytes_ (alias) Signed-off-by: Fabio Grätz * Make numpy an explicit dependency Signed-off-by: Fabio Grätz * Pin numpy to <2 Signed-off-by: Fabio Grätz --------- Signed-off-by: Fabio Grätz Co-authored-by: Fabio Grätz --- flytekit/types/schema/types.py | 2 +- flytekit/types/structured/structured_dataset.py | 2 +- pyproject.toml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/flytekit/types/schema/types.py b/flytekit/types/schema/types.py index 349b5aaf5a..75a54292c5 100644 --- a/flytekit/types/schema/types.py +++ b/flytekit/types/schema/types.py @@ -334,7 +334,7 @@ class FlyteSchemaTransformer(TypeTransformer[FlyteSchema]): datetime.datetime: SchemaType.SchemaColumn.SchemaColumnType.DATETIME, _np.timedelta64: SchemaType.SchemaColumn.SchemaColumnType.DURATION, datetime.timedelta: SchemaType.SchemaColumn.SchemaColumnType.DURATION, - _np.string_: SchemaType.SchemaColumn.SchemaColumnType.STRING, + _np.bytes_: SchemaType.SchemaColumn.SchemaColumnType.STRING, _np.str_: SchemaType.SchemaColumn.SchemaColumnType.STRING, _np.object_: SchemaType.SchemaColumn.SchemaColumnType.STRING, str: SchemaType.SchemaColumn.SchemaColumnType.STRING, diff --git a/flytekit/types/structured/structured_dataset.py b/flytekit/types/structured/structured_dataset.py index 1d2209a2b4..18e9eeb09a 100644 --- a/flytekit/types/structured/structured_dataset.py +++ b/flytekit/types/structured/structured_dataset.py @@ -340,7 +340,7 @@ def get_supported_types(): _datetime.datetime: type_models.LiteralType(simple=type_models.SimpleType.DATETIME), _np.timedelta64: type_models.LiteralType(simple=type_models.SimpleType.DURATION), _datetime.timedelta: type_models.LiteralType(simple=type_models.SimpleType.DURATION), - _np.string_: type_models.LiteralType(simple=type_models.SimpleType.STRING), + _np.bytes_: type_models.LiteralType(simple=type_models.SimpleType.STRING), _np.str_: type_models.LiteralType(simple=type_models.SimpleType.STRING), _np.object_: type_models.LiteralType(simple=type_models.SimpleType.STRING), str: type_models.LiteralType(simple=type_models.SimpleType.STRING), diff --git a/pyproject.toml b/pyproject.toml index 5aece34595..74a41ae422 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ dependencies = [ "marshmallow-enum", "marshmallow-jsonschema>=0.12.0", "mashumaro>=3.11", + "numpy<2", "protobuf!=4.25.0", "pyarrow", "pygments",