NumPy 2.0: Streamlined API and Major Changes for Developers

NumPy 2.0 marks its first major update since 2006, introducing a streamlined API, a new module structure, and the removal of outdated functions. Detailed in here, this version aims to make the library easier to learn and use. However, it comes with significant breaking changes that may affect downstream packages and end user code, as evidenced by issues with Facebook’s Ax, which had to restrict its NumPy version to avoid compatibility problems.

The upgrade also shifts the default integer type on Windows from 32-bit to 64-bit on all 64-bit systems, potentially impacting numerous applications. Developers should be wary of indirect dependencies that could introduce NumPy 2.0 and break continuous integration jobs, as happened with one developer.

For those navigating the transition, a migration guide and a plugin rule for the Ruff linter are available to help adapt existing code. Once compatibility issues are resolved, users will benefit from performance improvements like accelerated sorting functions and new data types, enhancing overall efficiency and functionality in scientific computing applications.