diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bbee1506..2932271b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,6 +37,9 @@ jobs: - os: "ubuntu-latest" env: "minimal-requirements" python-version: "3.10" + - os: "windows-latest" + env: "env-numpy1" + python-version: "3.10" steps: - uses: actions/checkout@v4 with: diff --git a/ci/env-numpy1.yml b/ci/env-numpy1.yml new file mode 100644 index 00000000..30dccdc0 --- /dev/null +++ b/ci/env-numpy1.yml @@ -0,0 +1,30 @@ +name: flox-tests +channels: + - conda-forge +dependencies: + - asv + - cachey + - cftime + - codecov + - cubed>=0.14.3 + - dask-core + - pandas + - numpy<2 + - scipy + - lxml # for mypy coverage report + - matplotlib + - pip + - pytest + - pytest-cov + - pytest-pretty + - pytest-xdist + - syrupy + - pre-commit + - numpy_groupies>=0.9.19 + - pooch + - toolz + - numba + - numbagg>=0.3 + - hypothesis + - pip: + - git+https://github.com/dcherian/xarray.git@flox-preserve-dtype diff --git a/flox/core.py b/flox/core.py index 7cab9b39..7e5362e1 100644 --- a/flox/core.py +++ b/flox/core.py @@ -2419,7 +2419,7 @@ def groupby_reduce( ) is_bool_array = np.issubdtype(array.dtype, bool) - array = array.astype(np.intp) if is_bool_array else array + array = array.astype(np.int_) if is_bool_array else array isbins = _atleast_1d(isbin, nby) @@ -2778,7 +2778,7 @@ def groupby_scan( return array is_bool_array = np.issubdtype(array.dtype, bool) - array = array.astype(np.intp) if is_bool_array else array + array = array.astype(np.int_) if is_bool_array else array if expected_groups is not None: raise NotImplementedError("Setting `expected_groups` and binning is not supported yet.") @@ -2812,9 +2812,9 @@ def groupby_scan( # it defaults to the dtype of a, unless a # has an integer dtype with a precision less than that of the default platform integer. if array.dtype.kind == "i": - agg.dtype = np.result_type(array.dtype, np.intp) + agg.dtype = np.result_type(array.dtype, np.int_) elif array.dtype.kind == "u": - agg.dtype = np.result_type(array.dtype, np.uintp) + agg.dtype = np.result_type(array.dtype, np.uint) else: agg.dtype = array.dtype if dtype is None else dtype diff --git a/flox/xrdtypes.py b/flox/xrdtypes.py index 34d0d2a5..e1b9bcce 100644 --- a/flox/xrdtypes.py +++ b/flox/xrdtypes.py @@ -179,9 +179,9 @@ def _maybe_promote_int(dtype) -> np.dtype: if not isinstance(dtype, np.dtype): dtype = np.dtype(dtype) if dtype.kind == "i": - dtype = np.result_type(dtype, np.intp) + dtype = np.result_type(dtype, np.int_) elif dtype.kind == "u": - dtype = np.result_type(dtype, np.uintp) + dtype = np.result_type(dtype, np.uint) return dtype diff --git a/tests/conftest.py b/tests/conftest.py index 4413ea1e..3158936d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,6 +12,7 @@ settings.register_profile( "default", max_examples=300, + deadline=500, suppress_health_check=[HealthCheck.filter_too_much, HealthCheck.too_slow], verbosity=Verbosity.verbose, ) diff --git a/tests/test_core.py b/tests/test_core.py index 94e32a6d..164f87b3 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -2005,4 +2005,4 @@ def test_blockwise_avoid_rechunk(): by = np.array(["1", "1", "0", "", "0", ""], dtype="