sphinx-autodoc-typehints icon indicating copy to clipboard operation
sphinx-autodoc-typehints copied to clipboard

nptyping dependency is troubled

Open 0-wiz-0 opened this issue 1 year ago • 1 comments

nptyping hasn't been updated for numpy 2, which makes the self tests fail with:

tests/test_sphinx_autodoc_typehints.py:54: in <module>
    import nptyping
/usr/pkg/lib/python3.12/site-packages/nptyping/__init__.py:32: in <module>
    from nptyping.ndarray import NDArray
/usr/pkg/lib/python3.12/site-packages/nptyping/ndarray.py:40: in <module>
    from nptyping.shape import Shape
/usr/pkg/lib/python3.12/site-packages/nptyping/shape.py:29: in <module>
    from nptyping.shape_expression import (
/usr/pkg/lib/python3.12/site-packages/nptyping/shape_expression.py:36: in <module>
    from nptyping.typing_ import ShapeExpression, ShapeTuple
/usr/pkg/lib/python3.12/site-packages/nptyping/typing_.py:51: in <module>
    Bool8 = np.bool8
/usr/pkg/lib/python3.12/site-packages/numpy/__init__.py:414: in __getattr__
    raise AttributeError("module {!r} has no attribute "
E   AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?

There's a bug report open at nptyping in https://github.com/ramonhagenaars/nptyping/issues/124 with no reply. At least one other project has switched to numpy.typing: https://github.com/mhe/pynrrd/pull/154

0-wiz-0 avatar Oct 19 '24 11:10 0-wiz-0

PR Welcome.

gaborbernat avatar Oct 20 '24 05:10 gaborbernat

Thank you!

0-wiz-0 avatar Jan 03 '25 09:01 0-wiz-0

If you're interested in restoring that functionality, my fork of nptyping has the few changes necessary to work with numpy v2: https://github.com/jasper-tms/nptyping

jasper-tms avatar Jul 11 '25 18:07 jasper-tms