Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/sanchit-misra/scanpy into s…
Browse files Browse the repository at this point in the history
…cale-mean-variance
  • Loading branch information
kaushalprasadhial committed Jan 7, 2025
2 parents 56bd438 + 5654389 commit 8f357fb
Show file tree
Hide file tree
Showing 63 changed files with 1,411 additions and 1,014 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Bug report
description: Scanpy doesn’t do what it should? Please help us fix it!
#title: ...
type: Bug
labels:
- Bug 🐛
- Triage 🩺
#assignees: []
body:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: Scanpy Community Forum
url: https://discourse.scverse.org/
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/enhancement-request.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Enhancement request
description: Anything you’d like to see in scanpy?
#title: ...
type: Enhancement
labels:
- Enhancement ✨
- Triage 🩺
#assignees: []
body:
Expand All @@ -14,6 +14,7 @@ body:
- 'Additional function parameters / changed functionality / changed defaults?'
- 'New analysis tool: A simple analysis tool you have been using and are missing in `sc.tools`?'
- 'New plotting function: A kind of plot you would like to seein `sc.pl`?'
- 'Improved documentation or error message?'
- 'Other?'
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.2
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand Down
107 changes: 74 additions & 33 deletions ci/scripts/min-deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sys
from collections import deque
from contextlib import ExitStack
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING

Expand All @@ -25,6 +26,8 @@

if TYPE_CHECKING:
from collections.abc import Generator, Iterable, Sequence
from collections.abc import Set as AbstractSet
from typing import Any, Self


def min_dep(req: Requirement) -> Requirement:
Expand Down Expand Up @@ -77,48 +80,86 @@ def extract_min_deps(


class Args(argparse.Namespace):
path: Path
"""\
Parse a pyproject.toml file and output a list of minimum dependencies.
Output is optimized for `[uv] pip install` (see `-o`/`--output` for details).
"""

_path: Path
output: Path | None
extras: list[str]
_extras: list[str]
_all_extras: bool

@classmethod
def parse(cls, argv: Sequence[str] | None = None) -> Self:
return cls.parser().parse_args(argv, cls())

@classmethod
def parser(cls) -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog="min-deps",
description=cls.__doc__,
usage="pip install `python min-deps.py pyproject.toml`",
)
parser.add_argument(
"_path",
metavar="pyproject.toml",
type=Path,
help="Path to pyproject.toml to parse minimum dependencies from",
)
parser.add_argument(
"--extras",
dest="_extras",
metavar="EXTRA",
type=str,
nargs="*",
default=(),
help="extras to install",
)
parser.add_argument(
"--all-extras",
dest="_all_extras",
action="store_true",
help="get all extras",
)
parser.add_argument(
*("--output", "-o"),
metavar="FILE",
type=Path,
default=None,
help=(
"output file (default: stdout). "
"Without this option, output is space-separated for direct passing to `pip install`. "
"With this option, output written to a file newline-separated file usable as `requirements.txt` or `constraints.txt`."
),
)
return parser

@cached_property
def pyproject(self) -> dict[str, Any]:
return tomllib.loads(self._path.read_text())

@cached_property
def extras(self) -> AbstractSet[str]:
if self._extras:
if self._all_extras:
sys.exit("Cannot specify both --extras and --all-extras")
return dict.fromkeys(self._extras).keys()
if not self._all_extras:
return set()
return self.pyproject["project"]["optional-dependencies"].keys()


def main(argv: Sequence[str] | None = None) -> None:
parser = argparse.ArgumentParser(
prog="min-deps",
description=(
"Parse a pyproject.toml file and output a list of minimum dependencies. "
"Output is optimized for `[uv] pip install` (see `-o`/`--output` for details)."
),
usage="pip install `python min-deps.py pyproject.toml`",
)
parser.add_argument(
"path", type=Path, help="pyproject.toml to parse minimum dependencies from"
)
parser.add_argument(
"--extras", type=str, nargs="*", default=(), help="extras to install"
)
parser.add_argument(
*("--output", "-o"),
type=Path,
default=None,
help=(
"output file (default: stdout). "
"Without this option, output is space-separated for direct passing to `pip install`. "
"With this option, output written to a file newline-separated file usable as `requirements.txt` or `constraints.txt`."
),
)

args = parser.parse_args(argv, Args())

pyproject = tomllib.loads(args.path.read_text())
args = Args.parse(argv)

project_name = pyproject["project"]["name"]
project_name = args.pyproject["project"]["name"]
deps = [
*map(Requirement, pyproject["project"]["dependencies"]),
*map(Requirement, args.pyproject["project"]["dependencies"]),
*(Requirement(f"{project_name}[{extra}]") for extra in args.extras),
]

min_deps = extract_min_deps(deps, pyproject=pyproject)
min_deps = extract_min_deps(deps, pyproject=args.pyproject)

sep = "\n" if args.output else " "
with ExitStack() as stack:
Expand Down
6 changes: 5 additions & 1 deletion ci/scripts/towncrier_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def main(argv: Sequence[str] | None = None) -> None:
f"--base={base_branch}",
f"--title={pr_title}",
f"--body={pr_description}",
*(["--label=no milestone"] if base_branch == "main" else []),
*(
["--label=no milestone", "--label=Development Process 🚀"]
if base_branch == "main"
else []
),
*(["--dry-run"] if args.dry_run else []),
],
check=True,
Expand Down
1 change: 1 addition & 0 deletions docs/api/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
pp.filter_genes_dispersion
pp.normalize_per_cell
pp.subsample
```
2 changes: 1 addition & 1 deletion docs/api/preprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For visual quality control, see {func}`~scanpy.pl.highest_expr_genes` and
pp.normalize_total
pp.regress_out
pp.scale
pp.subsample
pp.sample
pp.downsample_counts
```

Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
rapids_singlecell=("https://rapids-singlecell.readthedocs.io/en/latest/", None),
scipy=("https://docs.scipy.org/doc/scipy/", None),
seaborn=("https://seaborn.pydata.org/", None),
session_info2=("https://session-info2.readthedocs.io/en/stable/", None),
squidpy=("https://squidpy.readthedocs.io/en/stable/", None),
sklearn=("https://scikit-learn.org/stable/", None),
)

Expand Down
38 changes: 38 additions & 0 deletions docs/release-notes/1.11.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(v1.11.0)=
### 1.11.0rc1 {small}`2024-12-20`

### Features

- {func}`~scanpy.pp.sample` supports both upsampling and downsampling of observations and variables. {func}`~scanpy.pp.subsample` is now deprecated. {smaller}`G Eraslan & P Angerer` ({pr}`943`)
- Add `layer` argument to {func}`scanpy.tl.score_genes` and {func}`scanpy.tl.score_genes_cell_cycle` {smaller}`L Zappia` ({pr}`2921`)
- Prevent `raw` conflict with `layer` in {func}`~scanpy.tl.score_genes` {smaller}`S Dicks` ({pr}`3155`)
- Add support for `median` as an aggregation function to the `Aggregation` class in `scanpy.get._aggregated.py`. This allows for median-based aggregation of data (e.g., pseudobulk), complementing existing methods like mean- and sum-based aggregation {smaller}`M Dehkordi (Farhad)` ({pr}`3180`)
- Add `key_added` argument to {func}`~scanpy.pp.pca`, {func}`~scanpy.tl.tsne` and {func}`~scanpy.tl.umap` {smaller}`P Angerer` ({pr}`3184`)
- Support running {func}`scanpy.pp.pca` on sparse Dask arrays with the `'covariance_eigh'` solver {smaller}`P Angerer` ({pr}`3263`)
- Use upstreamed {class}`~sklearn.decomposition.PCA` implementation for {class}`~scipy.sparse.csr_array` and {class}`~scipy.sparse.csr_matrix` (see {ref}`sklearn:changes_1_4`) {smaller}`P Angerer` ({pr}`3267`)
- Add explicit support to {func}`scanpy.pp.pca` for `svd_solver='covariance_eigh'` {smaller}`P Angerer` ({pr}`3296`)
- Add support {class}`dask.array.Array` to {func}`scanpy.pp.calculate_qc_metrics` {smaller}`I Gold` ({pr}`3307`)
- Support `layer` parameter in {func}`scanpy.pl.highest_expr_genes` {smaller}`P Angerer` ({pr}`3324`)
- Run numba functions single-threaded when called from inside of a ThreadPool {smaller}`P Angerer` ({pr}`3335`)
- Switch {func}`~scanpy.logging.print_header` and {func}`~scanpy.logging.print_versions` to {mod}`session_info2` {smaller}`P Angerer` ({pr}`3384`)
- Add sampling probabilities/mask parameter `p` to {func}`~scanpy.pp.sample` {smaller}`P Angerer` ({pr}`3410`)

### Performance

- Speed up {func}`~scanpy.pp.regress_out` {smaller}`P Ashish, P Angerer & S Dicks` ({pr}`3284`)

### Documentation

- Improve {func}`~scanpy.external.pp.harmony_integrate` docs {smaller}`D Kühl` ({pr}`3362`)
- Raise {exc}`FutureWarning` when calling deprecated {mod}`scanpy.pp` functions {smaller}`P Angerer` ({pr}`3380`)
- | Deprecate … | in favor of … |
| --- | --- |
| {func}`scanpy.read_visium` | {func}`squidpy.read.visium` |
| {func}`scanpy.datasets.visium_sge` | {func}`squidpy.datasets.visium` |
| {func}`scanpy.pl.spatial` | {func}`squidpy.pl.spatial_scatter` |

{smaller}`P Angerer` ({pr}`3407`)

### Bug fixes

- Upper-bound {mod}`sklearn` `<1.6.0` due to {issue}`dask/dask-ml#1002` {smaller}`Ilan Gold` ({pr}`3393`)
2 changes: 1 addition & 1 deletion docs/release-notes/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `1.5.0` release adds a lot of new functionality, much of which takes advanta

#### Spatial data support

- Basic analysis {doc}`/tutorials/spatial/basic-analysis` and integration with single cell data {doc}`/tutorials/spatial/integration-scanorama` {smaller}`G Palla`
- Tutorials for basic analysis and integration with single cell data {smaller}`G Palla`
- {func}`~scanpy.read_visium` read 10x Visium data {pr}`1034` {smaller}`G Palla, P Angerer, I Virshup`
- {func}`~scanpy.datasets.visium_sge` load Visium data directly from 10x Genomics {pr}`1013` {smaller}`M Mirkazemi, G Palla, P Angerer`
- {func}`~scanpy.pl.spatial` plot spatial data {pr}`1012` {smaller}`G Palla, P Angerer`
Expand Down
1 change: 0 additions & 1 deletion docs/release-notes/2921.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3155.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3180.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3184.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3263.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3267.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3284.performance.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3296.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3307.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3324.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3335.feature.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/release-notes/3362.doc.md

This file was deleted.

22 changes: 9 additions & 13 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ trajectories/index

## Spatial data

```{seealso}
For more up-to-date tutorials on working with spatial data, see:
* [SquidPy tutorials](https://squidpy.readthedocs.io/en/stable/notebooks/tutorials/index.html)
* [SpatialData tutorials](https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks.html)
* [Scverse ecosystem spatial tutorials](https://scverse.org/learn/)
```

```{toctree}
:maxdepth: 2
spatial/index
```

## Experimental

Expand All @@ -64,3 +51,12 @@ experimental/index
A number of older tutorials can be found at:

* The [`scanpy_usage`](https://github.com/scverse/scanpy_usage) repository

```{seealso}
Scanpy used to have tutorials for its (now deprecated) spatial data functionality.x
For up-to-date tutorials on working with spatial data, see:
* SquidPy {doc}`squidpy:notebooks/tutorials/index`
* [SpatialData tutorials](https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks.html)
* [Scverse ecosystem spatial tutorials](https://scverse.org/learn/)
```
1 change: 0 additions & 1 deletion docs/tutorials/spatial/basic-analysis.ipynb

This file was deleted.

8 changes: 0 additions & 8 deletions docs/tutorials/spatial/index.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/tutorials/spatial/integration-scanorama.ipynb

This file was deleted.

2 changes: 1 addition & 1 deletion hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ overrides.matrix.deps.env-vars = [
{ if = ["min"], key = "UV_CONSTRAINT", value = "ci/scanpy-min-deps.txt" },
]
overrides.matrix.deps.pre-install-commands = [
{ if = ["min"], value = "uv run ci/scripts/min-deps.py pyproject.toml -o ci/scanpy-min-deps.txt" },
{ if = ["min"], value = "uv run ci/scripts/min-deps.py pyproject.toml --all-extras -o ci/scanpy-min-deps.txt" },
]
overrides.matrix.deps.python = [
{ if = ["min"], value = "3.10" },
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,26 @@ classifiers = [
]
dependencies = [
"anndata>=0.8",
"numpy>=1.23",
"numpy>=1.24",
"matplotlib>=3.6",
"pandas >=1.5",
"scipy>=1.8",
"seaborn>=0.13",
"h5py>=3.7",
"tqdm",
"scikit-learn>=1.1",
"scikit-learn>=1.1,<1.6.0",
"statsmodels>=0.13",
"patsy!=1.0.0", # https://github.com/pydata/patsy/issues/215
"networkx>=2.7",
"natsort",
"joblib",
"numba>=0.56",
"numba>=0.57",
"umap-learn>=0.5,!=0.5.0",
"pynndescent>=0.5",
"packaging>=21.3",
"session-info",
"session-info2",
"legacy-api-wrap>=1.4", # for positional API deprecations
"typing-extensions; python_version < '3.13'",
]
dynamic = ["version"]

Expand Down
Loading

0 comments on commit 8f357fb

Please sign in to comment.