From 04e79fcf2f17a9b2212a6692802ac1805b945a26 Mon Sep 17 00:00:00 2001 From: Charles Guan <3221512+charlesincharge@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:26:51 -0800 Subject: [PATCH 1/3] Bump numpy versions for newer Python versions --- dependencies/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dependencies/requirements.txt b/dependencies/requirements.txt index 14a87b7..790df7d 100644 --- a/dependencies/requirements.txt +++ b/dependencies/requirements.txt @@ -1,3 +1,4 @@ numpy==1.21.5; python_version<'3.8' -numpy>=1.20.0,<2.0.0; python_version>='3.8' +numpy>=1.20.0,<2.0.0; python_version>='3.8' and python_version<'3.10' +numpy>=1.25.0,<2.0.0; python_version>='3.10' typing_extensions>=4.0.0,<5.0.0; python_version<'3.10' From e6996339efc1c1bdef0695b5e0078b9160c1ee84 Mon Sep 17 00:00:00 2001 From: Charles Guan <3221512+charlesincharge@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:36:48 -0800 Subject: [PATCH 2/3] Remove some references to deprecated types --- nptyping/__init__.py | 14 -------------- nptyping/typing_.py | 14 -------------- nptyping/typing_.pyi | 7 ------- 3 files changed, 35 deletions(-) diff --git a/nptyping/__init__.py b/nptyping/__init__.py index 5fd5b2c..feb5f12 100644 --- a/nptyping/__init__.py +++ b/nptyping/__init__.py @@ -41,10 +41,8 @@ from nptyping.structure import Structure from nptyping.typing_ import ( Bool, - Bool8, Byte, Bytes, - Bytes0, CDouble, CFloat, Character, @@ -67,7 +65,6 @@ Half, Inexact, Int, - Int0, Int8, Int16, Int32, @@ -81,17 +78,14 @@ LongLong, Number, Object, - Object0, Short, SignedInteger, Single, SingleComplex, - Str0, String, Timedelta64, UByte, UInt, - UInt0, UInt8, UInt16, UInt32, @@ -103,7 +97,6 @@ UnsignedInteger, UShort, Void, - Void0, ) __all__ = [ @@ -123,9 +116,7 @@ "DType", "Number", "Bool", - "Bool8", "Object", - "Object0", "Datetime64", "Integer", "SignedInteger", @@ -137,7 +128,6 @@ "Short", "IntC", "IntP", - "Int0", "Int", "LongLong", "Timedelta64", @@ -150,7 +140,6 @@ "UShort", "UIntC", "UIntP", - "UInt0", "UInt", "ULongLong", "Inexact", @@ -177,12 +166,9 @@ "LongComplex", "Flexible", "Void", - "Void0", "Character", "Bytes", "String", - "Bytes0", "Unicode", - "Str0", "DataFrame", ] diff --git a/nptyping/typing_.py b/nptyping/typing_.py index 2639e07..6a1475b 100644 --- a/nptyping/typing_.py +++ b/nptyping/typing_.py @@ -48,10 +48,8 @@ Number = np.number Bool = np.bool_ -Bool8 = np.bool8 Obj = np.object_ # Obj is a common abbreviation and should be usable. Object = np.object_ -Object0 = np.object0 Datetime64 = np.datetime64 Integer = np.integer SignedInteger = np.signedinteger @@ -63,7 +61,6 @@ Short = np.short IntC = np.intc IntP = np.intp -Int0 = np.int0 Int = np.integer # Int should translate to the "generic" int type. Int_ = np.int_ LongLong = np.longlong @@ -77,7 +74,6 @@ UShort = np.ushort UIntC = np.uintc UIntP = np.uintp -UInt0 = np.uint0 UInt = np.uint ULongLong = np.ulonglong Inexact = np.inexact @@ -104,22 +100,17 @@ LongComplex = np.longcomplex Flexible = np.flexible Void = np.void -Void0 = np.void0 Character = np.character Bytes = np.bytes_ Str = np.str_ String = np.string_ -Bytes0 = np.bytes0 Unicode = np.unicode_ -Str0 = np.str0 dtypes = [ (Number, "Number"), (Bool, "Bool"), - (Bool8, "Bool8"), (Obj, "Obj"), (Object, "Object"), - (Object0, "Object0"), (Datetime64, "Datetime64"), (Integer, "Integer"), (SignedInteger, "SignedInteger"), @@ -131,7 +122,6 @@ (Short, "Short"), (IntC, "IntC"), (IntP, "IntP"), - (Int0, "Int0"), (Int, "Int"), (LongLong, "LongLong"), (Timedelta64, "Timedelta64"), @@ -144,7 +134,6 @@ (UShort, "UShort"), (UIntC, "UIntC"), (UIntP, "UIntP"), - (UInt0, "UInt0"), (UInt, "UInt"), (ULongLong, "ULongLong"), (Inexact, "Inexact"), @@ -171,14 +160,11 @@ (LongComplex, "LongComplex"), (Flexible, "Flexible"), (Void, "Void"), - (Void0, "Void0"), (Character, "Character"), (Bytes, "Bytes"), (String, "String"), (Str, "Str"), - (Bytes0, "Bytes0"), (Unicode, "Unicode"), - (Str0, "Str0"), ] name_per_dtype = dict(dtypes) diff --git a/nptyping/typing_.pyi b/nptyping/typing_.pyi index fcf83ce..a5e3376 100644 --- a/nptyping/typing_.pyi +++ b/nptyping/typing_.pyi @@ -47,9 +47,7 @@ ShapeTuple: TypeAlias = Tuple[int, ...] Number: TypeAlias = np.dtype[np.number[Any]] Bool: TypeAlias = np.dtype[np.bool_] -Bool8: TypeAlias = np.dtype[np.bool8] Object: TypeAlias = np.dtype[np.object_] -Object0: TypeAlias = np.dtype[np.object0] Datetime64: TypeAlias = np.dtype[np.datetime64] Integer: TypeAlias = np.dtype[np.integer[Any]] SignedInteger: TypeAlias = np.dtype[np.signedinteger[Any]] @@ -61,7 +59,6 @@ Byte: TypeAlias = np.dtype[np.byte] Short: TypeAlias = np.dtype[np.short] IntC: TypeAlias = np.dtype[np.intc] IntP: TypeAlias = np.dtype[np.intp] -Int0: TypeAlias = np.dtype[np.int0] Int: TypeAlias = np.dtype[np.int_] LongLong: TypeAlias = np.dtype[np.longlong] Timedelta64: TypeAlias = np.dtype[np.timedelta64] @@ -74,7 +71,6 @@ UByte: TypeAlias = np.dtype[np.ubyte] UShort: TypeAlias = np.dtype[np.ushort] UIntC: TypeAlias = np.dtype[np.uintc] UIntP: TypeAlias = np.dtype[np.uintp] -UInt0: TypeAlias = np.dtype[np.uint0] UInt: TypeAlias = np.dtype[np.uint] ULongLong: TypeAlias = np.dtype[np.ulonglong] Inexact: TypeAlias = np.dtype[np.inexact[Any]] @@ -101,14 +97,11 @@ CLongFloat: TypeAlias = np.dtype[np.clongfloat] LongComplex: TypeAlias = np.dtype[np.longcomplex] Flexible: TypeAlias = np.dtype[np.flexible] Void: TypeAlias = np.dtype[np.void] -Void0: TypeAlias = np.dtype[np.void0] Character: TypeAlias = np.dtype[np.character] Bytes: TypeAlias = np.dtype[np.bytes_] Str: TypeAlias = np.dtype[np.str_] String: TypeAlias = np.dtype[np.string_] -Bytes0: TypeAlias = np.dtype[np.bytes0] Unicode: TypeAlias = np.dtype[np.unicode_] -Str0: TypeAlias = np.dtype[np.str0] dtype_per_name: Dict[str, np.dtype[Any]] name_per_dtype: Dict[np.dtype[Any], str] From d6faa9a43d42bb80eb4b72646873c42385687c8a Mon Sep 17 00:00:00 2001 From: Charles Guan <3221512+charlesincharge@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:09:59 -0800 Subject: [PATCH 3/3] Remove other references to deprecated numpy types --- USERDOCS.md | 56 ++++++++++++++++++---------------------- tests/test_lib_export.py | 7 ----- tests/test_mypy.py | 14 ---------- 3 files changed, 25 insertions(+), 52 deletions(-) diff --git a/USERDOCS.md b/USERDOCS.md index f992cd4..45508c8 100644 --- a/USERDOCS.md +++ b/USERDOCS.md @@ -4,30 +4,31 @@ # *User documentation* -* [Introduction](#Introduction) -* [Quickstart](#Quickstart) -* [Usage](#Usage) - * [NDArray](#NDArray) - * [Shape expressions](#Shape-expressions) - * [Syntax](#Syntax-shape-expressions) - * [Validation](#Validation) - * [Normalization](#Normalization) - * [Variables](#Variables) - * [Wildcards](#Shape-Wildcards) - * [N dimensions](#N-dimensions) - * [Dimension breakdowns](#Dimension-breakdowns) - * [Labels](#Labels) - * [DTypes](#DTypes) - * [Structure expressions](#Structure-expressions) - * [Syntax](#Syntax-structure-expressions) - * [Subarrays](#Subarrays) - * [Wildcards](#Structure-Wildcards) - * [RecArray](#RecArray) - * [Pandas DataFrame](#Pandas-DataFrame) -* [Examples](#Examples) -* [Similar projects](#Similar-projects) -* [FAQ](#FAQ) -* [About](#About) +- [*User documentation*](#user-documentation) + - [Introduction](#introduction) + - [Quickstart](#quickstart) + - [Usage](#usage) + - [NDArray](#ndarray) + - [Shape expressions](#shape-expressions) + - [Syntax shape expressions](#syntax-shape-expressions) + - [Validation](#validation) + - [Normalization](#normalization) + - [Variables](#variables) + - [Shape Wildcards](#shape-wildcards) + - [N dimensions](#n-dimensions) + - [Dimension breakdowns](#dimension-breakdowns) + - [Labels](#labels) + - [DTypes](#dtypes) + - [Structure expressions](#structure-expressions) + - [Syntax structure expressions](#syntax-structure-expressions) + - [Subarrays](#subarrays) + - [Structure Wildcards](#structure-wildcards) + - [RecArray](#recarray) + - [Pandas DataFrame](#pandas-dataframe) + - [Examples](#examples) + - [Similar projects](#similar-projects) + - [FAQ](#faq) + - [About](#about) ## Introduction @@ -275,10 +276,8 @@ The second argument of `NDArray` can be `typing.Any` or any of the following dty ... print(dtype_name) Number Bool -Bool8 Obj Object -Object0 Datetime64 Integer SignedInteger @@ -290,7 +289,6 @@ Byte Short IntC IntP -Int0 Int LongLong Timedelta64 @@ -303,7 +301,6 @@ UByte UShort UIntC UIntP -UInt0 UInt ULongLong Inexact @@ -330,14 +327,11 @@ CLongFloat LongComplex Flexible Void -Void0 Character Bytes String Str -Bytes0 Unicode -Str0 ``` These are special aliases for `numpy` dtypes. diff --git a/tests/test_lib_export.py b/tests/test_lib_export.py index bc8719d..4612969 100644 --- a/tests/test_lib_export.py +++ b/tests/test_lib_export.py @@ -22,9 +22,7 @@ def test_all(self): "DType", "Number", "Bool", - "Bool8", "Object", - "Object0", "Datetime64", "Integer", "SignedInteger", @@ -36,7 +34,6 @@ def test_all(self): "Short", "IntC", "IntP", - "Int0", "Int", "LongLong", "Timedelta64", @@ -49,7 +46,6 @@ def test_all(self): "UShort", "UIntC", "UIntP", - "UInt0", "UInt", "ULongLong", "Inexact", @@ -76,13 +72,10 @@ def test_all(self): "LongComplex", "Flexible", "Void", - "Void0", "Character", "Bytes", "String", - "Bytes0", "Unicode", - "Str0", "DataFrame", } diff --git a/tests/test_mypy.py b/tests/test_mypy.py index 56afeb9..4ead616 100644 --- a/tests/test_mypy.py +++ b/tests/test_mypy.py @@ -171,9 +171,7 @@ def test_mypy_accepts_nptyping_types(self): NDArray, Number, Bool, - Bool8, Object, - Object0, Datetime64, Integer, SignedInteger, @@ -185,7 +183,6 @@ def test_mypy_accepts_nptyping_types(self): Short, IntC, IntP, - Int0, Int, LongLong, Timedelta64, @@ -198,7 +195,6 @@ def test_mypy_accepts_nptyping_types(self): UShort, UIntC, UIntP, - UInt0, UInt, ULongLong, Inexact, @@ -225,20 +221,15 @@ def test_mypy_accepts_nptyping_types(self): LongComplex, Flexible, Void, - Void0, Character, Bytes, String, - Bytes0, Unicode, - Str0, ) NDArray[Any, Number] NDArray[Any, Bool] - NDArray[Any, Bool8] NDArray[Any, Object] - NDArray[Any, Object0] NDArray[Any, Datetime64] NDArray[Any, Integer] NDArray[Any, SignedInteger] @@ -250,7 +241,6 @@ def test_mypy_accepts_nptyping_types(self): NDArray[Any, Short] NDArray[Any, IntC] NDArray[Any, IntP] - NDArray[Any, Int0] NDArray[Any, Int] NDArray[Any, LongLong] NDArray[Any, Timedelta64] @@ -263,7 +253,6 @@ def test_mypy_accepts_nptyping_types(self): NDArray[Any, UShort] NDArray[Any, UIntC] NDArray[Any, UIntP] - NDArray[Any, UInt0] NDArray[Any, UInt] NDArray[Any, ULongLong] NDArray[Any, Inexact] @@ -290,13 +279,10 @@ def test_mypy_accepts_nptyping_types(self): NDArray[Any, LongComplex] NDArray[Any, Flexible] NDArray[Any, Void] - NDArray[Any, Void0] NDArray[Any, Character] NDArray[Any, Bytes] NDArray[Any, String] - NDArray[Any, Bytes0] NDArray[Any, Unicode] - NDArray[Any, Str0] """ )