From 679a7ce30cb3366319bce2f4211dd62a5a80c87c Mon Sep 17 00:00:00 2001 From: Dan Redding <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 25 Jul 2024 22:35:27 +0100 Subject: [PATCH] ci: relax `numpy<=2.0.0` constraint (#3504) * ci(ruff): add `numpy` rules https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy * fix(ruff): Replace legacy random `NPY002` https://docs.astral.sh/ruff/rules/numpy-legacy-random/ * ci: remove `numpy` upper bound --- pyproject.toml | 4 +++- tests/utils/test_utils.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index eaa9e1014..c8147e628 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ all = [ "vega_datasets>=0.9.0", "vl-convert-python>=1.5.0", "pandas>=0.25.3", - "numpy<2.0.0", + "numpy", "pyarrow>=11", "vegafusion[embed]>=1.6.6", "anywidget>=0.9.0", @@ -305,6 +305,8 @@ select = [ "D", # multi-line-summary-second-line "D213", + # numpy-specific-rules + "NPY", ] ignore = [ # Whitespace before ':' diff --git a/tests/utils/test_utils.py b/tests/utils/test_utils.py index c3a73acb7..e1e5eaeb3 100644 --- a/tests/utils/test_utils.py +++ b/tests/utils/test_utils.py @@ -30,7 +30,8 @@ def _check(arr, typ): _check(pd.date_range("2012", "2013"), "temporal") _check(pd.timedelta_range(365, periods=12), "temporal") - nulled = pd.Series(np.random.randint(10, size=10)) + rng = np.random.default_rng() + nulled = pd.Series(rng.integers(10, size=10)) nulled[0] = None _check(nulled, "quantitative") _check(["a", "b", "c"], "nominal")