diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 47575b89..812b3e07 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,18 +7,18 @@ default_stages: minimum_pre_commit_version: 2.9.3 repos: - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.5.1 hooks: - id: mypy additional_dependencies: [numpy, pandas, types-requests] exclude: .scripts/ci/download_data.py|squidpy/datasets/_(dataset|image).py # See https://github.com/pre-commit/mirrors-mypy/issues/33 - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black additional_dependencies: [toml] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0 + rev: v3.0.3 hooks: - id: prettier - repo: https://github.com/pre-commit/pre-commit-hooks @@ -51,12 +51,12 @@ repos: name: Check executable files use .sh extension types: [shell, executable] - repo: https://github.com/asottile/blacken-docs - rev: 1.15.0 + rev: 1.16.0 hooks: - id: blacken-docs - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.0.281 + rev: v0.0.292 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/README.rst b/README.rst index 393949c3..8dd65a26 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -|PyPI| |Downloads| |CI| |Docs| |Coverage| |Discourse| |Zulip| +|PyPI| |Downloads| |CI| |Docs| |Coverage| |Discourse| |Zulip| |NumFOCUS| Squidpy - Spatial Single Cell Analysis in Python ================================================ @@ -10,6 +10,11 @@ tissue images if available. Visit our `documentation`_ for installation, tutorials, examples and more. +Squidpy is part of the scverse project (`website`_, `governance`_) and is fiscally sponsored by `NumFOCUS`_. +Please consider making a tax-deductible `donation`_ to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs. + +|NumFOCUS logo| + Manuscript ---------- Please see our manuscript `Palla, Spitzer et al. (2022)`_ in **Nature Methods** to learn more. @@ -69,9 +74,21 @@ We are happy about any contributions! Before you start, check out our `contribut :target: https://scverse.zulipchat.com :alt: Zulip +.. |NumFOCUS| image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A + :target: http://numfocus.org + :alt: NumFOCUS + +.. |NumFOCUS logo| image:: https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png + :target: https://numfocus.org/project/scverse + :width: 200 + .. _Palla, Spitzer et al. (2022): https://doi.org/10.1038/s41592-021-01358-2 .. _scanpy: https://scanpy.readthedocs.io/en/stable/ .. _anndata: https://anndata.readthedocs.io/en/stable/ .. _napari: https://napari.org/ .. _skimage: https://scikit-image.org/ .. _documentation: https://squidpy.readthedocs.io/en/stable/ +.. _website: https://scverse.org/ +.. _governance: https://scverse.org/about/roles/ +.. _NumFOCUS: https://numfocus.org/ +.. _donation: https://numfocus.org/donate-to-scverse/ diff --git a/pyproject.toml b/pyproject.toml index df125603..a3924571 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ dependencies = [ "numba>=0.56.4", "numpy>=1.23.0", "omnipath>=1.0.7", - "pandas>=1.5.0", + "pandas>=2.1.0", "Pillow>=8.0.0", "scanpy>=1.9.3", "scikit-image>=0.19,<=0.20", diff --git a/src/squidpy/gr/_ligrec.py b/src/squidpy/gr/_ligrec.py index bd2b2bbb..9007b962 100644 --- a/src/squidpy/gr/_ligrec.py +++ b/src/squidpy/gr/_ligrec.py @@ -508,8 +508,13 @@ def find_min_gene_in_complex(_complex: str | None) -> str | None: return complexes[0] df = self._data[complexes].mean() - - return str(df.index[df.argmin()]) + try: + return str(df.index[df.argmin()]) + except ValueError as e: + if "attempt to get argmin of an empty sequence" in str(e): + return str(df.index[0]) + else: + logg.error(e) if TYPE_CHECKING: assert isinstance(self._interactions, pd.DataFrame) diff --git a/src/squidpy/gr/_ppatterns.py b/src/squidpy/gr/_ppatterns.py index 2a033c3a..868767d9 100644 --- a/src/squidpy/gr/_ppatterns.py +++ b/src/squidpy/gr/_ppatterns.py @@ -418,7 +418,7 @@ def co_occurrence( labs_splits = tuple(s for s in np.array_split(labs, n_splits, axis=0) if len(s)) # type: ignore[arg-type] # create idx array including unique combinations and self-comparison x, y = np.triu_indices_from(np.empty((n_splits, n_splits))) # type: ignore[arg-type] - idx_splits = [(i, j) for i, j in zip(x, y)] + idx_splits = list(zip(x, y)) n_jobs = _get_n_cores(n_jobs) start = logg.info( diff --git a/src/squidpy/im/_container.py b/src/squidpy/im/_container.py index 238e273c..8aebc571 100644 --- a/src/squidpy/im/_container.py +++ b/src/squidpy/im/_container.py @@ -883,7 +883,7 @@ def uncrop( scales.discard(None) if len(scales) != 1: - raise ValueError(f"Unable to uncrop images of different scales `{sorted((scales))}`.") + raise ValueError(f"Unable to uncrop images of different scales `{sorted(scales)}`.") scale, *_ = scales if shape is None: diff --git a/tests/_data/ligrec_no_numba.pickle b/tests/_data/ligrec_no_numba.pickle index 073ed151..e83cc26a 100644 Binary files a/tests/_data/ligrec_no_numba.pickle and b/tests/_data/ligrec_no_numba.pickle differ diff --git a/tests/_data/paul15_means.pickle b/tests/_data/paul15_means.pickle index 6f102886..e368b82e 100644 Binary files a/tests/_data/paul15_means.pickle and b/tests/_data/paul15_means.pickle differ diff --git a/tests/plotting/test_graph.py b/tests/plotting/test_graph.py index a45efc3b..6620fbd4 100644 --- a/tests/plotting/test_graph.py +++ b/tests/plotting/test_graph.py @@ -117,7 +117,7 @@ def test_plot_cbar_kwargs(self, adata: AnnData): gr.spatial_neighbors(adata) gr.nhood_enrichment(adata, cluster_key=C_KEY) - pl.nhood_enrichment(adata, cluster_key=C_KEY, cbar_kwargs={"label": "FOOBARBAZQUUX", "filled": False}) + pl.nhood_enrichment(adata, cluster_key=C_KEY, cbar_kwargs={"label": "FOOBARBAZQUUX"}) class TestLigrec(PlotTester, metaclass=PlotTesterMeta):