pyvista / pymeshfix

Python Wrapper for MeshFix: easily repair holes in surface meshes
http://pymeshfix.pyvista.org
GNU General Public License v3.0
293 stars 29 forks source link

MAINT: Fixes for NumPy deprecation and 3.10 #42

Closed larsoner closed 2 years ago

larsoner commented 2 years ago
  1. np.float is just an alias for float so avoid the deprecation warning about it.
  2. Change to manylinux2014 for Python3.10 support
  3. Add shims for VTK not having a 3.10 wheel (via wheels.pyvistia.org)

FYI it would be good to merge this and cut a release since there are no Python 3.10 wheels for pymeshfix.

larsoner commented 2 years ago

I have a feeling oldest-supported-numpy might work for us here (somehow), but I'm just bumping the requirements_build.txt here hoping things come back green

larsoner commented 2 years ago

Finally green!

larsoner commented 2 years ago

@pyvista/developers this one is ready for review. It would be nice to merge this so that we could get 3.10 wheels on PyPi

larsoner commented 2 years ago

... I went a step further and just called ascontiguousarray with a dtype, as it should essentially be a no-op / just create a view if it's already contiguous, e.g.:

>>> import numpy as np
>>> x = np.array([1.], np.float64)
>>> y = np.ascontiguousarray(x, dtype=np.float64)
>>> y[0] = 0
>>> x
array([0.])

I also fixed some plain assert statements to raise a proper error, and changed to bare raise Exceptions to raise RuntimeErrors

adeak commented 2 years ago

... I went a step further and just called ascontiguousarray with a dtype, as it should essentially be a no-op / just create a view if it's already contiguous, e.g.:

Yeah, that's what I had in mind.

I also fixed some plain assert statements to raise a proper error, and changed to bare raise Exceptions to raise RuntimeErrors

Good idea, thanks. I wonder if we should define some more meaningful errors for these... not sure it's worth it for purity's sake.

larsoner commented 2 years ago

Good idea, thanks. I wonder if we should define some more meaningful errors for these... not sure it's worth it for purity's sake.

Seems like overkill. I doubt users will hit these very often... but moving to a more specific builtin error type seemed like a minimal amount of effort required to make it slightly better here.

larsoner commented 2 years ago

All green again, okay to merge @adeak ?

adeak commented 2 years ago

Sorry, @larsoner, I can't review any of the CI changes :( The numpy part seems good to me.

larsoner commented 2 years ago

I think the CI stuff is necessary to get 3.10 support. If anyone else wants to look and finds problems, I'm happy to open another PR, or revert and try again! But in the meantime I'll go ahead and merge and cut a release to see if PyPi wheels show up.