Skip to content

Commit 70d6d5c

Browse files
committed
anndata and mudata only for typechecking
1 parent fda07ef commit 70d6d5c

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

pyproject.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@ authors = [
1616
{ name = "Niklas Müller-Bötticher", email = "[email protected]" },
1717
{ name = "Shashwat Sahay", email = "[email protected]" },
1818
]
19-
dependencies = [
20-
"anndata>=0.10",
21-
"igraph",
22-
"leidenalg~=0.10.2",
23-
"mudata~=0.3",
24-
"numpy>=1.21",
25-
"scipy>=1.9",
26-
]
19+
dependencies = ["igraph", "leidenalg~=0.10.2", "numpy>=1.21", "scipy>=1.9"]
2720
classifiers = [
2821
"Intended Audience :: Science/Research",
2922
"Programming Language :: Python",
@@ -39,12 +32,13 @@ docs = [
3932
"sphinx",
4033
"sphinx-copybutton",
4134
"sphinx-rtd-theme",
35+
"anndata>=0.10",
4236
"scanpy",
4337
"squidpy",
4438
"dask<2025", # incompatibility of squidpy with dask >= 2025
4539
"myst-nb",
4640
]
47-
dev = ["spatialleiden[docs]", "pre-commit"]
41+
dev = ["spatialleiden[docs]", "mudata~=0.3", "pre-commit"]
4842

4943
[project.urls]
5044
Homepage = "https://github.com/HiDiHlabs/SpatialLeiden"

spatialleiden/_multiplex_leiden.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
from __future__ import annotations
2+
13
from collections.abc import Collection, Iterable, Mapping
24
from types import NoneType
3-
from typing import Any, Type, TypeAlias, TypeVar
5+
from typing import TYPE_CHECKING, Any, Type, TypeAlias, TypeVar
46

57
import leidenalg as la
68
import numpy as np
7-
from anndata import AnnData
89
from igraph import Graph
910
from leidenalg.VertexPartition import MutableVertexPartition
10-
from mudata import MuData
1111
from numpy.typing import NDArray
1212
from scipy.sparse import find, sparray, spmatrix
1313

14+
if TYPE_CHECKING:
15+
from anndata import AnnData
16+
from mudata import MuData
17+
1418
_GraphArray: TypeAlias = sparray | spmatrix | np.ndarray
1519

1620

spatialleiden/_resolution_search.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
from __future__ import annotations
2+
13
from collections.abc import Callable
4+
from typing import TYPE_CHECKING
25
from warnings import warn
36

4-
from anndata import AnnData
5-
67
from ._multiplex_leiden import leiden, spatialleiden
78

9+
if TYPE_CHECKING:
10+
from anndata import AnnData
11+
812

913
def _search_resolution(
1014
fn: Callable[[float], int],

0 commit comments

Comments
 (0)