Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ test-full = [
"zappy",
# additional tested algorithms
"scanpy[louvain]",
"scanpy[magic]",
"scanpy[skmisc]",
"scanpy[harmony]",
"scanpy[scanorama]",
"scanpy[dask-ml]",
]
doc = [
Expand Down Expand Up @@ -142,11 +139,7 @@ dev = [
paga = [ "igraph" ]
louvain = [ "igraph", "louvain>=0.6.0,!=0.6.2" ] # Louvain community detection
leiden = [ "igraph>=0.10", "leidenalg>=0.9.0" ] # Leiden community detection
bbknn = [ "bbknn" ] # Batch balanced KNN (batch correction)
magic = [ "magic-impute>=2.0" ] # MAGIC imputation method
skmisc = [ "scikit-misc>=0.1.3" ] # highly_variable_genes method 'seurat_v3'
harmony = [ "harmonypy" ] # Harmony dataset integration
scanorama = [ "scanorama" ] # Scanorama dataset integration
scrublet = [ "scikit-image>=0.20" ] # Doublet detection with automatic thresholds
# Acceleration
rapids = [ "cudf>=0.9", "cuml>=0.9", "cugraph>=0.9" ] # GPU accelerated calculation of neighbors
Expand Down
12 changes: 10 additions & 2 deletions src/scanpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
)
from anndata import AnnData, concat

from . import datasets, experimental, external, get, logging, metrics, queries
from . import datasets, experimental, get, logging, metrics, queries
from . import plotting as pl
from . import preprocessing as pp
from . import tools as tl
Expand All @@ -67,7 +67,6 @@
"concat",
"datasets",
"experimental",
"external",
"get",
"logging",
"metrics",
Expand All @@ -91,3 +90,12 @@
"tl",
"write",
]


def __getattr__(name: str) -> object:
if name == "external":
from . import external

return external

raise AttributeError(name)
9 changes: 7 additions & 2 deletions src/scanpy/external/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
from __future__ import annotations

import sys
import warnings

from .. import _utils
from . import exporting, pl, pp, tl

__all__: list[str] = ["exporting", "pl", "pp", "tl"]

_utils.annotate_doc_types(sys.modules[__name__], "scanpy")
del sys, _utils

__all__ = ["exporting", "pl", "pp", "tl"]
msg = "The `scanpy.external` module is deprecated and will be removed in a future version."
warnings.warn(msg, DeprecationWarning, stacklevel=2)

del msg, sys, _utils, warnings
23 changes: 0 additions & 23 deletions tests/external/test_harmony_integrate.py

This file was deleted.

33 changes: 0 additions & 33 deletions tests/external/test_harmony_timeseries.py

This file was deleted.

38 changes: 0 additions & 38 deletions tests/external/test_hashsolo.py

This file was deleted.

56 changes: 0 additions & 56 deletions tests/external/test_magic.py

This file was deleted.

14 changes: 0 additions & 14 deletions tests/external/test_palantir.py

This file was deleted.

21 changes: 0 additions & 21 deletions tests/external/test_phenograph.py

This file was deleted.

22 changes: 0 additions & 22 deletions tests/external/test_sam.py

This file was deleted.

22 changes: 0 additions & 22 deletions tests/external/test_scanorama_integrate.py

This file was deleted.

27 changes: 0 additions & 27 deletions tests/external/test_wishbone.py

This file was deleted.

12 changes: 8 additions & 4 deletions tests/test_package_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
"sc.tl",
"sc.pl",
"sc.experimental.pp",
"sc.external.pp",
"sc.external.tl",
"sc.external.pl",
"sc.external.exporting",
"sc.get",
"sc.logging",
# "sc.neighbors", # Not documented
Expand All @@ -54,11 +50,19 @@


@pytest.mark.xfail(reason="TODO: unclear if we want this to totally match, let’s see")
@pytest.mark.filterwarnings("ignore::DeprecationWarning:scanpy.external")
def test_descend_classes_and_funcs():
funcs = set(descend_classes_and_funcs(scanpy, "scanpy"))
assert {p.values[0] for p in api_functions} == funcs


def test_external_is_deprecated() -> None:
with pytest.warns(DeprecationWarning, match=r"scanpy.external"):
import scanpy.external

importlib.reload(scanpy.external)


@pytest.mark.filterwarnings("error::FutureWarning:.*Import anndata.*")
def test_import_future_anndata_import_warning():
import scanpy
Expand Down
Loading