Skip to content

Commit c07b295

Browse files
committed
NumPy 2.1 support: Update numpy types
bool8, float_, and longfloat were removed in NumPy 2.1
1 parent e4a3fa4 commit c07b295

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

hug/output_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def register_json_converter(function):
142142
def numpy_listable(item):
143143
return item.tolist()
144144

145-
@json_convert(str, numpy.unicode_)
145+
@json_convert(str, numpy.str_)
146146
def numpy_stringable(item):
147147
return str(item)
148148

requirements/build_common.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ python-coveralls==2.9.2
66
wheel==0.33.4
77
PyJWT==1.7.1
88
pytest-xdist==1.29.0
9-
numpy<1.16
9+
numpy<2.2

requirements/build_windows.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ marshmallow==2.18.1
55
pytest==4.6.3
66
wheel==0.33.4
77
pytest-xdist==1.29.0
8-
numpy==1.15.4
8+
numpy<2.2

requirements/development.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ wheel
1212
pytest-xdist==1.29.0
1313
marshmallow==2.18.1
1414
ujson==1.35
15-
numpy<1.16
16-
15+
numpy<2.2

tests/test_output_format.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def test_json_converter_numpy_types():
375375

376376
# Some type names are merely shorthands.
377377
# The following shorthands for built-in types are excluded: numpy.bool, numpy.int, numpy.float.
378-
np_bool_types = [numpy.bool_, numpy.bool8]
378+
np_bool_types = [numpy.bool_, numpy.bool_]
379379
np_int_types = [
380380
numpy.int_,
381381
numpy.byte,
@@ -398,14 +398,13 @@ def test_json_converter_numpy_types():
398398
numpy.ushort,
399399
]
400400
np_float_types = [
401-
numpy.float_,
402401
numpy.float32,
403402
numpy.float64,
404403
numpy.half,
405404
numpy.single,
406-
numpy.longfloat,
405+
numpy.longdouble,
407406
]
408-
np_unicode_types = [numpy.unicode_]
407+
np_unicode_types = [numpy.str_]
409408
np_bytes_types = [numpy.bytes_]
410409

411410
for np_type in np_bool_types:

0 commit comments

Comments
 (0)