Global state#

NumPy has a few import-time, compile-time, or runtime options which change the global behaviour. Most of these are related to performance or for debugging purposes and will not be interesting to the vast majority of users.

Testing planned future behavior#

NumPy has some code paths which are planned to be activated in the future but are not yet the default behavior. You can try testing some of these which may be shipped with a new “major” release (NumPy 2.0) by setting an environment before importing NumPy:

NPY_NUMPY_2_BEHAVIOR=1

By default this will also activate the NEP 50 related setting NPY_PROMOTION_STATE (please see the NEP for details on this).

Changed in version 1.25.2: This variable is only checked on the first import.