Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy deprecation warnings when importing nptyping #102

Open
dstansby opened this issue Feb 27, 2023 · 4 comments
Open

numpy deprecation warnings when importing nptyping #102

dstansby opened this issue Feb 27, 2023 · 4 comments

Comments

@dstansby
Copy link

I'm doing some testing of a package that has nptyping in the dependency chain, and when I catch the warnigns as erros with pytest some warnings are coming from nptyping:

   .tox/py38/lib/python3.8/site-packages/nrrd/formatters.py:3: in <module>
      import nptyping as npt
  .tox/py38/lib/python3.8/site-packages/nptyping/__init__.py:32: in <module>
      from nptyping.ndarray import NDArray
  .tox/py38/lib/python3.8/site-packages/nptyping/ndarray.py:40: in <module>
      from nptyping.shape import Shape
  .tox/py38/lib/python3.8/site-packages/nptyping/shape.py:29: in <module>
      from nptyping.shape_expression import (
  .tox/py38/lib/python3.8/site-packages/nptyping/shape_expression.py:36: in <module>
      from nptyping.typing_ import ShapeExpression, ShapeTuple
  .tox/py38/lib/python3.8/site-packages/nptyping/typing_.py:54: in <module>
      Object0 = np.object0
  .tox/py38/lib/python3.8/site-packages/numpy/__init__.py:294: in __getattr__
      warnings.warn(msg, DeprecationWarning, stacklevel=2)
  E   DeprecationWarning: `np.object0` is a deprecated alias for ``np.object0` is a deprecated alias for `np.object_`. `object` can be used instead.  (Deprecated NumPy 1.24)`.  (Deprecated NumPy 1.24)
@rfechtner
Copy link

Any update on this topic?
Should be rather fix to implement, dropping the legacy types. I don't mind drawing an MR for this - I an just a a bit too short sighted to fully grasp some further reaching implications.

@anosillus
Copy link

anosillus commented May 25, 2023

It appears that the some type API in NumPy has changed since NumPy 1.24, starting from May 23.
Some nptyping API no longer work with the latest version of NumPy.
I'm conducting research to send a fix pull request.
I expect it will be easy to follow the new one, but harder to ensure backward compatibility.
Is it a good idea to use conditional branching to handle this?

@anosillus
Copy link

anosillus commented May 25, 2023

The reason nptyping no longer works with the latest version of NumPy is likely due to these changes.

numpy/numpy#22607
numpy/numpy#22385

@anosillus
Copy link

anosillus commented May 25, 2023

Currently, calling nptyping in the latest numpy environment result in an error.
I can send a pull request immediately if I just erase the API that is diprecated in numpy from nptyping to solve that, but is that the right policy?
If there are no problems, I will make that pull request in this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants