Not too long ago, NumPy 2.0 got released. cluster_utils didn't work with it out of the box, so we restricted the dependency to numpy<2.
Looking into it now, it seems the only actual problem was in the Discrete distribution when using booleans: Using NumPy's choice() converted the list of native bools to an array of np.bool. Later one, this clashed when passing the parameters to the job script, where they are parsed with ast.literal_eval(). Simply converting back to list with .tolist() seems to be enough to fix this.
I also enabled the NPY warnings of ruff, which can aid migration. The only warnings it showed where related to usage of np.random (it's preferred to use a different rng nowadays), though. While this might not be an issue for Numpy 2, I still changed to using a random generator created with np.random.default_rng() and added a utility function to easily access it thoughout the project.
Not too long ago, NumPy 2.0 got released. cluster_utils didn't work with it out of the box, so we restricted the dependency to numpy<2.
Looking into it now, it seems the only actual problem was in the
Discrete
distribution when using booleans: Using NumPy'schoice()
converted the list of native bools to an array of np.bool. Later one, this clashed when passing the parameters to the job script, where they are parsed withast.literal_eval()
. Simply converting back to list with.tolist()
seems to be enough to fix this.I also enabled the
NPY
warnings of ruff, which can aid migration. The only warnings it showed where related to usage ofnp.random
(it's preferred to use a different rng nowadays), though. While this might not be an issue for Numpy 2, I still changed to using a random generator created withnp.random.default_rng()
and added a utility function to easily access it thoughout the project.Closes #112