C API Cleanup
NumPy 2.0 performs a major C API cleanup. Obsolete macros are removed, headers reorganized, and ABI versioning strengthened. C extensions compiled for NumPy 1.x must be recompiled.
C Migration Guide
c
/* Before (NumPy 1.x) */
#include <numpy/arrayobject.h>
#include <numpy/ndarraytypes.h>
/* Obsolete macro: NPY_CHAR */
/* After (NumPy 2.0) */
#include <numpy/arrayobject.h>
/* NPY_CHAR removed */
/* Use NPY_UNICODE or StringDType */
/* Check ABI compatibility */
#if NPY_ABI_VERSION < 0x02000000
#error "Recompile with NumPy >= 2.0"
#endif
Tip: use numpy.get_include() in your setup.py and test with numpy>=2.0 in CI.
