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

Support numpy 2.0 #476

Merged
merged 5 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansys/mapdl/reader/cython/_binary_reader.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ cdef np.ndarray wrap_array(void* c_ptr, int size, int type_flag, int prec_flag):
array_wrapper.set_data(size, c_ptr, my_dtype)

cdef np.ndarray ndarray
ndarray = np.array(array_wrapper, copy=False)
ndarray = np.array(array_wrapper)

Comment on lines 366 to 368
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we resolve this based on the numpy version used? Preventing users from using numpy 1.x only for this change seems a bit excessive IMO. Many libraries are still struggling with the switch to numpy 2.X so this might be an issue.

# Assign our object to the 'base' of the ndarray object
np.PyArray_SetBaseObject(ndarray, array_wrapper)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"cython==3.0.5",
"oldest-supported-numpy",
"cython>=3.0.0",
"numpy>=2,<3",
"setuptools>=45.0",
"wheel>=0.37.0",
]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
install_requires=[
"appdirs>=1.4.0",
"matplotlib>=3.0.0",
"numpy>=1.16.0,<2",
"numpy>=2,<3",
"pyvista>=0.32.0,<0.44",
"tqdm>=4.45.0",
"vtk>=9.0.0",
Expand Down
Loading