From b824fecf054601805376ec18c9b326ac535d047b Mon Sep 17 00:00:00 2001 From: Emily Mo-Hellenbrand <125683999+EmilyMohellenbrandQC@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:46:10 +0200 Subject: [PATCH] Fix public export promote_nullable (#14) Co-authored-by: Aditya Goel <48102515+adityagoel4512@users.noreply.github.com> --- CHANGELOG.rst | 7 +++++++ ndonnx/__init__.py | 1 + ndonnx/_data_types/__init__.py | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 914aec6..3e30bde 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,13 @@ Changelog ========= +0.6.0 (2024-07-11) +------------------ + +**Other changes** + +- :func:`ndonnx.promote_nullable` is now publicly exported + 0.5.0 (2024-07-01) ------------------ diff --git a/ndonnx/__init__.py b/ndonnx/__init__.py index 5e5fd01..8ab826b 100644 --- a/ndonnx/__init__.py +++ b/ndonnx/__init__.py @@ -18,6 +18,7 @@ NullableIntegral, NullableNumerical, Numerical, + promote_nullable, from_numpy_dtype, bool, float32, diff --git a/ndonnx/_data_types/__init__.py b/ndonnx/_data_types/__init__.py index 28b8779..6504e00 100644 --- a/ndonnx/_data_types/__init__.py +++ b/ndonnx/_data_types/__init__.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations +from warnings import warn from .aliases import ( bool, @@ -50,6 +51,7 @@ from .structtype import StructType +# TODO: to be removed def promote_nullable(dtype: StructType | CoreType) -> _NullableCore: """Promotes a non-nullable type to its nullable counterpart, if present. @@ -69,6 +71,12 @@ def promote_nullable(dtype: StructType | CoreType) -> _NullableCore: If the input type is unknown to ``ndonnx``. """ + warn( + "Function 'ndonnx.promote_nullable' will be deprecated in ndonnx 0.7. " + "To create nullable array, use 'ndonnx.additional.make_nullable' instead.", + DeprecationWarning, + ) + if dtype == bool: return nbool elif dtype == float32: