Skip to content

Commit 6426186

Browse files
authored
chore!: remove old positional compat (#3984)
1 parent e8b2b0b commit 6426186

56 files changed

Lines changed: 33 additions & 908 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/release-notes/3984.chore.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove compatibility helper for passing parameters positionally {smaller}`P Angerer`

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ dependencies = [
5555
"fast-array-utils[accel,sparse]>=1.2.1",
5656
"h5py>=3.11",
5757
"joblib",
58-
"legacy-api-wrap>=1.5", # for positional API deprecations
5958
"matplotlib>=3.9",
6059
"natsort",
6160
"networkx>=2.8.8",
@@ -214,7 +213,6 @@ lint.pylint.max-args = 10
214213
lint.pylint.max-positional-args = 5
215214

216215
[tool.ruff.lint.flake8-tidy-imports.banned-api]
217-
"legacy_api_wrap.legacy_api".msg = "Use scanpy._compat.old_positionals instead"
218216
"numba.jit".msg = "Use `scanpy._compat.njit` instead"
219217
"numba.njit".msg = "Use `scanpy._compat.njit` instead"
220218
"numpy.bool_".msg = "Use `np.bool` instead"

src/scanpy/_compat.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from pathlib import Path
88
from typing import TYPE_CHECKING, Literal, cast, overload
99

10-
import legacy_api_wrap
1110
from packaging.version import Version
1211
from scipy import sparse
1312

@@ -26,7 +25,6 @@
2625
"deprecated",
2726
"fullname",
2827
"njit",
29-
"old_positionals",
3028
"pkg_metadata",
3129
"pkg_version",
3230
"warn",
@@ -79,17 +77,7 @@ def pkg_version(package: str) -> Version:
7977

8078

8179
# File prefixes for us and decorators we use
82-
_FILE_PREFIXES: tuple[str, ...] = (
83-
str(Path(__file__).parent),
84-
str(Path(legacy_api_wrap.__file__).parent),
85-
)
86-
87-
88-
old_positionals = partial(
89-
legacy_api_wrap.legacy_api, # noqa: TID251
90-
category=FutureWarning,
91-
skip_file_prefixes=_FILE_PREFIXES,
92-
)
80+
_FILE_PREFIXES: tuple[str, ...] = (str(Path(__file__).parent),)
9381

9482

9583
# we’re not using _FILE_PREFIXES here,

src/scanpy/_settings/__init__.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import TYPE_CHECKING, Literal, get_args
99

1010
from .. import logging
11-
from .._compat import deprecated, old_positionals
11+
from .._compat import deprecated
1212
from .._singleton import SingletonMeta, documenting
1313
from ..logging import _RootLogger, _set_log_file, _set_log_level
1414
from .verbosity import Verbosity
@@ -334,20 +334,6 @@ def categories_to_ignore(cls, categories_to_ignore: Iterable[str]) -> None:
334334
def set_figure_params(cls, *args, **kwargs) -> None:
335335
cls._set_figure_params(*args, **kwargs)
336336

337-
@old_positionals(
338-
"scanpy",
339-
"dpi",
340-
"dpi_save",
341-
"frameon",
342-
"vector_friendly",
343-
"fontsize",
344-
"figsize",
345-
"color_map",
346-
"format",
347-
"facecolor",
348-
"transparent",
349-
"ipython_format",
350-
)
351337
def _set_figure_params( # noqa: PLR0913
352338
cls,
353339
*,

src/scanpy/datasets/_datasets.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from anndata import AnnData, OldFormatWarning
1010

1111
from .. import _utils
12-
from .._compat import deprecated, old_positionals
12+
from .._compat import deprecated
1313
from .._settings import settings
1414
from .._utils._doctests import doctest_internet, doctest_needs
1515
from ..readwrite import read, read_h5ad, read_visium
@@ -54,9 +54,6 @@
5454
HERE = Path(__file__).parent
5555

5656

57-
@old_positionals(
58-
"n_variables", "n_centers", "cluster_std", "n_observations", "random_state"
59-
)
6057
def blobs(
6158
*,
6259
n_variables: int = 11,

src/scanpy/external/exporting.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from fast_array_utils.stats import mean_var
1515
from pandas.api.types import CategoricalDtype
1616

17-
from .._compat import old_positionals
1817
from .._utils import NeighborsView
1918

2019
if TYPE_CHECKING:
@@ -25,14 +24,6 @@
2524
__all__ = ["cellbrowser", "spring_project"]
2625

2726

28-
@old_positionals(
29-
"subplot_name",
30-
"cell_groupings",
31-
"custom_color_tracks",
32-
"total_counts_key",
33-
"neighbors_key",
34-
"overwrite",
35-
)
3627
def spring_project( # noqa: PLR0912, PLR0915
3728
adata: AnnData,
3829
project_dir: Path | str,
@@ -472,16 +463,6 @@ def _export_paga_to_spring(adata, paga_coords, outpath) -> None:
472463
Path(outpath).write_text(json.dumps(paga_data, indent=4))
473464

474465

475-
@old_positionals(
476-
"embedding_keys",
477-
"annot_keys",
478-
"cluster_field",
479-
"nb_marker",
480-
"skip_matrix",
481-
"html_dir",
482-
"port",
483-
"do_debug",
484-
)
485466
def cellbrowser( # noqa: PLR0913
486467
adata: AnnData,
487468
data_dir: Path | str,

src/scanpy/external/pl.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import matplotlib.pyplot as plt
99
import numpy as np
1010

11-
from .._compat import deprecated, old_positionals
11+
from .._compat import deprecated
1212
from .._utils import _doc_params
1313
from .._utils._doctests import doctest_needs
1414
from ..plotting import _scrublet, _utils, embedding
@@ -162,7 +162,6 @@ def harmony_timeseries(
162162
return axes
163163

164164

165-
@old_positionals("c", "cmap", "linewidth", "edgecolor", "axes", "colorbar", "s")
166165
def sam(
167166
adata: AnnData,
168167
projection: str | np.ndarray = "X_umap",
@@ -257,17 +256,6 @@ def sam(
257256
return axes
258257

259258

260-
@old_positionals(
261-
"no_bins",
262-
"smoothing_factor",
263-
"min_delta",
264-
"show_variance",
265-
"figsize",
266-
"return_fig",
267-
"show",
268-
"save",
269-
"ax",
270-
)
271259
@_doc_params(show_save_ax=doc_show_save_ax)
272260
def wishbone_marker_trajectory( # noqa: PLR0913
273261
adata: AnnData,

src/scanpy/external/pp/_bbknn.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from typing import TYPE_CHECKING
44

5-
from ..._compat import old_positionals
65
from ..._utils._doctests import doctest_needs
76

87
if TYPE_CHECKING:
@@ -12,7 +11,6 @@
1211
from sklearn.metrics import DistanceMetric
1312

1413

15-
@old_positionals("batch_key", "use_rep", "approx", "use_annoy", "metric", "copy")
1614
@doctest_needs("bbknn")
1715
def bbknn( # noqa: PLR0913
1816
adata: AnnData,

src/scanpy/external/pp/_dca.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from types import MappingProxyType
44
from typing import TYPE_CHECKING
55

6-
from ..._compat import old_positionals
7-
86
if TYPE_CHECKING:
97
from collections.abc import Mapping, Sequence
108
from typing import Any, Literal
@@ -16,31 +14,6 @@
1614
type _AEType = Literal["zinb-conddisp", "zinb", "nb-conddisp", "nb"]
1715

1816

19-
@old_positionals(
20-
"ae_type",
21-
"normalize_per_cell",
22-
"scale",
23-
"log1p",
24-
"hidden_size",
25-
"hidden_dropout",
26-
"batchnorm",
27-
"activation",
28-
"init",
29-
"network_kwds",
30-
"epochs",
31-
"reduce_lr",
32-
"early_stop",
33-
"batch_size",
34-
"optimizer",
35-
"random_state",
36-
"threads",
37-
"learning_rate",
38-
"verbose",
39-
"training_kwds",
40-
"return_model",
41-
"return_info",
42-
"copy",
43-
)
4417
def dca( # noqa: PLR0913
4518
adata: AnnData,
4619
mode: Literal["denoise", "latent"] = "denoise",

src/scanpy/external/pp/_harmony_integrate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import numpy as np
88

9-
from ..._compat import old_positionals
109
from ..._utils._doctests import doctest_needs
1110

1211
if TYPE_CHECKING:
@@ -15,7 +14,6 @@
1514
from anndata import AnnData
1615

1716

18-
@old_positionals("basis", "adjusted_basis")
1917
@doctest_needs("harmonypy")
2018
def harmony_integrate(
2119
adata: AnnData,

0 commit comments

Comments
 (0)