Skip to content

Commit e8b2b0b

Browse files
authored
ci: circumvent hatch incompatibility (#3987)
1 parent e8dc05d commit e8b2b0b

21 files changed

Lines changed: 49 additions & 50 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
cache: 'pip'
4040

4141
- name: Cache datasets
42-
uses: actions/cache@v4
42+
uses: actions/cache@v5
4343
with:
4444
path: |
4545
~/.cache

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with: { enable-cache: false }
2828
- id: get-envs
2929
run: |
30-
ENVS_JSON=$(NO_COLOR=1 uvx hatch env show --json | jq -c 'to_entries
30+
ENVS_JSON=$(NO_COLOR=1 uvx '--with=virtualenv<21' hatch env show --json | jq -c 'to_entries
3131
| map(
3232
select(.key | startswith("hatch-test"))
3333
| {
@@ -55,15 +55,15 @@ jobs:
5555
python-version: ${{ matrix.env.python }}
5656

5757
- name: Cache downloaded data
58-
uses: actions/cache@v4
58+
uses: actions/cache@v5
5959
with:
6060
path: .pytest_cache/d/scanpy-data
6161
key: pytest
6262

6363
- name: Install dependencies
6464
run: |
6565
echo "::group::Install hatch"
66-
uv tool install hatch
66+
uv tool install hatch '--with=virtualenv<21'
6767
echo "::endgroup::"
6868
echo "::group::Create environment"
6969
hatch -v env create ${{ matrix.env.name }}

.readthedocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ build:
1616
- asdf global uv latest
1717
pre_build:
1818
# run towncrier to preview the next version’s release notes
19-
- ( find docs/release-notes -regex '[^.]+[.][^.]+.md' | grep -q . ) && uvx hatch run towncrier build --keep || true
19+
- ( find docs/release-notes -regex '[^.]+[.][^.]+.md' | grep -q . ) && uvx "--with=virtualenv<21" hatch run towncrier build --keep || true
2020
build:
2121
html:
22-
- uvx hatch run docs:build
22+
- uvx "--with=virtualenv<21" hatch run docs:build
2323
- mv docs/_build $READTHEDOCS_OUTPUT

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ def setup(app: Sphinx) -> None:
263263
"pandas.core.series.Series": "pandas.Series",
264264
# https://github.com/pandas-dev/pandas/issues/63810
265265
"pandas.api.typing.aliases.AnyArrayLike": ("doc", "pandas:reference/aliases"),
266-
"numpy.bool_": "numpy.bool", # Since numpy 2, numpy.bool is the canonical dtype
267266
**{
268267
f"numpy.{prefix}typing.{name}": ("py:data", f"numpy.typing.{name}")
269268
for name, prefix in product(["ArrayLike", "DTypeLike"], ["", "_"])

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ lint.pylint.max-positional-args = 5
217217
"legacy_api_wrap.legacy_api".msg = "Use scanpy._compat.old_positionals instead"
218218
"numba.jit".msg = "Use `scanpy._compat.njit` instead"
219219
"numba.njit".msg = "Use `scanpy._compat.njit` instead"
220-
"numpy.bool".msg = "Use `np.bool_` instead for numpy>=1.24<2 compatibility"
220+
"numpy.bool_".msg = "Use `np.bool` instead"
221221
"pandas.api.types.is_categorical_dtype".msg = "Use isinstance(s.dtype, CategoricalDtype) instead"
222222
"pandas.value_counts".msg = "Use pd.Series(a).value_counts() instead"
223223
"pytest.importorskip".msg = "Use the “@needs” decorator/mark instead"

src/scanpy/_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def select_groups(
801801
adata: AnnData,
802802
groups_order_subset: Iterable[str] | Literal["all"] = "all",
803803
key: str = "groups",
804-
) -> tuple[list[str], NDArray[np.bool_]]:
804+
) -> tuple[list[str], NDArray[np.bool]]:
805805
"""Get subset of groups in adata.obs[key]."""
806806
groups_order = adata.obs[key].cat.categories
807807
if f"{key}_masks" in adata.uns:

src/scanpy/get/_aggregated.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(
5555
groupby: pd.Categorical,
5656
data: Array,
5757
*,
58-
mask: NDArray[np.bool_] | None = None,
58+
mask: NDArray[np.bool] | None = None,
5959
) -> None:
6060
self.groupby = groupby
6161
if (missing := groupby.isna()).any():
@@ -188,7 +188,7 @@ def aggregate( # noqa: PLR0912
188188
func: AggType | Iterable[AggType],
189189
*,
190190
axis: Literal["obs", 0, "var", 1] | None = None,
191-
mask: NDArray[np.bool_] | str | None = None,
191+
mask: NDArray[np.bool] | str | None = None,
192192
dof: int = 1,
193193
layer: str | None = None,
194194
obsm: str | None = None,
@@ -337,7 +337,7 @@ def _aggregate(
337337
by: pd.Categorical,
338338
func: AggType | Iterable[AggType],
339339
*,
340-
mask: NDArray[np.bool_] | None = None,
340+
mask: NDArray[np.bool] | None = None,
341341
dof: int = 1,
342342
) -> dict[AggType, np.ndarray | DaskArray]:
343343
msg = f"Data type {type(data)} not supported for aggregation"
@@ -353,7 +353,7 @@ def aggregate_dask_mean_var(
353353
data: DaskArray,
354354
by: pd.Categorical,
355355
*,
356-
mask: NDArray[np.bool_] | None = None,
356+
mask: NDArray[np.bool] | None = None,
357357
dof: int = 1,
358358
) -> MeanVarDict:
359359
mean = aggregate_dask(data, by, "mean", mask=mask, dof=dof)["mean"]
@@ -374,7 +374,7 @@ def aggregate_dask(
374374
by: pd.Categorical,
375375
func: AggType | Iterable[AggType],
376376
*,
377-
mask: NDArray[np.bool_] | None = None,
377+
mask: NDArray[np.bool] | None = None,
378378
dof: int = 1,
379379
) -> dict[AggType, DaskArray]:
380380
if not isinstance(data._meta, CSBase | np.ndarray):
@@ -465,7 +465,7 @@ def aggregate_array(
465465
by: pd.Categorical,
466466
func: AggType | Iterable[AggType],
467467
*,
468-
mask: NDArray[np.bool_] | None = None,
468+
mask: NDArray[np.bool] | None = None,
469469
dof: int = 1,
470470
) -> dict[AggType, np.ndarray]:
471471
groupby = Aggregate(groupby=by, data=data, mask=mask)
@@ -549,7 +549,7 @@ def _combine_categories(
549549
def sparse_indicator(
550550
categorical: pd.Categorical,
551551
*,
552-
mask: NDArray[np.bool_] | None = None,
552+
mask: NDArray[np.bool] | None = None,
553553
weight: NDArray[np.floating] | None = None,
554554
) -> sparse.coo_matrix:
555555
if mask is not None and weight is None:

src/scanpy/get/get.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def _set_obs_rep(
475475
raise AssertionError(msg)
476476

477477

478-
def _check_mask[M: NDArray[np.bool_] | NDArray[np.floating] | pd.Series | None](
478+
def _check_mask[M: NDArray[np.bool] | NDArray[np.floating] | pd.Series | None](
479479
data: AnnData | np.ndarray | CSBase | DaskArray,
480480
mask: str | M,
481481
dim: Literal["obs", "var"],

src/scanpy/metrics/_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _(val: pd.DataFrame | pd.Series) -> NDArray:
124124

125125
def _vals_heterogeneous[V: NDArray | CSRBase](
126126
vals: V,
127-
) -> tuple[V, NDArray[np.bool_] | slice, NDArray[np.float64]]:
127+
) -> tuple[V, NDArray[np.bool] | slice, NDArray[np.float64]]:
128128
"""Check that values wont cause issues in computation.
129129
130130
Returns new set of vals, and indexer to put values back into result.

src/scanpy/plotting/_anndata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,16 @@ def _check_if_annotations(
229229
other_ax_obj, "var" if axis_name == "obs" else "obs"
230230
).index
231231

232-
def is_annotation(needle: pd.Index) -> NDArray[np.bool_]:
232+
def is_annotation(needle: pd.Index) -> NDArray[np.bool]:
233233
return needle.isin({None}) | needle.isin(annotations) | needle.isin(names)
234234

235235
if not is_annotation(pd.Index([x, y])).all():
236236
return False
237237

238238
color_idx = pd.Index(colors if colors is not None else [])
239239
# Colors are valid
240-
color_valid: NDArray[np.bool_] = np.fromiter(
241-
map(is_color_like, color_idx), dtype=np.bool_, count=len(color_idx)
240+
color_valid: NDArray[np.bool] = np.fromiter(
241+
map(is_color_like, color_idx), dtype=np.bool, count=len(color_idx)
242242
)
243243
# Annotation names are valid too
244244
color_valid[~color_valid] = is_annotation(color_idx[~color_valid])

0 commit comments

Comments
 (0)