Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/sanchit-misra/scanpy into f…
Browse files Browse the repository at this point in the history
…ast_read_h5ad
  • Loading branch information
kaushalprasadhial committed Jan 16, 2025
2 parents 8aba7ee + fa38823 commit 89c6c72
Show file tree
Hide file tree
Showing 100 changed files with 904 additions and 645 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Thumbs.db

# IDEs and editors
/.idea/
/.vscode/

# asv benchmark files
/benchmarks/.asv
Expand Down
17 changes: 10 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.9.1
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: ["--fix"]
- id: ruff-format
types_or: [python, pyi, jupyter]
# The following can be removed once PLR0917 is out of preview
- name: ruff preview rules
id: ruff
types_or: [python, pyi, jupyter]
args: ["--preview", "--select=PLR0917"]
- repo: https://github.com/flying-sheep/bibfmt
rev: v4.3.0
Expand All @@ -19,6 +16,15 @@ repos:
args:
- --sort-by-bibkey
- --drop=abstract
- repo: https://github.com/biomejs/pre-commit
rev: v0.6.1
hooks:
- id: biome-format
additional_dependencies: ["@biomejs/[email protected]"]
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand All @@ -34,6 +40,3 @@ repos:
- id: detect-private-key
- id: no-commit-to-branch
args: ["--branch=main"]

ci:
autofix_prs: false
5 changes: 5 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[formatting]
array_auto_collapse = false
column_width = 120
compact_arrays = false
indent_string = ' '
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Build Documentation",
"type": "debugpy",
"request": "launch",
"module": "sphinx",
"args": ["-M", "html", ".", "_build"],
"cwd": "${workspaceFolder}/docs",
"console": "internalConsole",
"justMyCode": false,
},
{
"name": "Python: Debug Test",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"console": "internalConsole",
"justMyCode": false,
"env": { "PYTEST_ADDOPTS": "--color=yes" },
"presentation": { "hidden": true },
},
],
}
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"[python][toml][json][jsonc]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll": "explicit",
},
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml",
},
"[json][jsonc]": {
"editor.defaultFormatter": "biomejs.biome",
},
"python.analysis.typeCheckingMode": "basic",
"python.testing.pytestArgs": ["-vv", "--color=yes"],
"python.testing.pytestEnabled": true,
"python.terminal.activateEnvironment": true,
}
2 changes: 1 addition & 1 deletion benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"natsort": [""],
"pandas": [""],
"memory_profiler": [""],
"zarr": [""],
"zarr": ["2.18.4"],
"pytest": [""],
"scanpy": [""],
"python-igraph": [""],
Expand Down
21 changes: 21 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"formatter": {
"indentStyle": "space",
"indentWidth": 4,
},
"overrides": [
{
"include": ["./.vscode/*.json", "**/*.jsonc", "**/asv.conf.json"],
"json": {
"formatter": {
"trailingCommas": "all",
},
"parser": {
"allowComments": true,
"allowTrailingCommas": true,
},
},
},
],
}
4 changes: 3 additions & 1 deletion ci/scripts/min-deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def extract_min_deps(

# If we are referring to other optional dependency lists, resolve them
if req.name == project_name:
assert req.extras, f"Project included itself as dependency, without specifying extras: {req}"
assert req.extras, (
f"Project included itself as dependency, without specifying extras: {req}"
)
for extra in req.extras:
extra_deps = pyproject["project"]["optional-dependencies"][extra]
dependencies += map(Requirement, extra_deps)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/preprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ For visual quality control, see {func}`~scanpy.pl.highest_expr_genes` and

### Batch effect correction

Also see [Data integration]. Note that a simple batch correction method is available via {func}`pp.regress_out`. Checkout {mod}`scanpy.external` for more.
Also see {ref}`data-integration`. Note that a simple batch correction method is available via {func}`pp.regress_out`. Checkout {mod}`scanpy.external` for more.

```{eval-rst}
.. autosummary::
Expand Down
2 changes: 2 additions & 0 deletions docs/api/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Compute densities on embeddings.
tl.paga
```

(data-integration)=

### Data integration

```{eval-rst}
Expand Down
19 changes: 11 additions & 8 deletions docs/contributors.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
# Contributors

[anndata graph](https://github.com/scverse/anndata/graphs/contributors>) | [scanpy graph](https://github.com/scverse/scanpy/graphs/contributors)| ☀ = maintainer

## Current developers

- [Isaac Virshup](https://github.com/ivirshup), lead developer since 2019 ☀
- [Gökcen Eraslan](https://twitter.com/gokcen), developer, diverse contributions ☀
- [Sergei Rybakov](https://github.com/Koncopd), developer, diverse contributions ☀
- [Fidel Ramirez](https://github.com/fidelram) developer, plotting ☀
- [Giovanni Palla](https://twitter.com/g_palla1), developer, spatial data
- [Malte Luecken](https://twitter.com/MDLuecken), developer, community & forum
- [Philipp Angerer](https://github.com/flying-sheep), lead developer since 2023, software quality, initial anndata conception ☀
- [Ilan Gold](https://github.com/ilan-gold), developer, Dask ☀
- [Severin Dicks](https://github.com/SeverinDicks), developer, performance ☀
- [Lukas Heumos](https://twitter.com/LukasHeumos), developer, diverse contributions
- [Philipp Angerer](https://github.com/flying-sheep), developer, software quality, initial anndata conception ☀

## Other roles

- [Isaac Virshup](https://github.com/ivirshup), lead developer 2019-2023
- [Alex Wolf](https://twitter.com/falexwolf): lead developer 2016-2019, initial anndata & scanpy conception
- [Fabian Theis](https://twitter.com/fabian_theis) & lab: enabling guidance, support and environment

## Former developers

- Tom White: developer 2018-2019, distributed computing
- [Tom White](https://github.com/tomwhite): developer 2018-2019, distributed computing
- [Gökcen Eraslan](https://twitter.com/gokcen), developer, diverse contributions
- [Sergei Rybakov](https://github.com/Koncopd), developer, diverse contributions
- [Fidel Ramirez](https://github.com/fidelram) developer, plotting
- [Giovanni Palla](https://twitter.com/g_palla1), developer, spatial data
- [Malte Luecken](https://twitter.com/MDLuecken), developer, community & forum
1 change: 1 addition & 0 deletions docs/dev/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
5. {ref}`Make sure all tests are passing <tests>`
6. {ref}`Build and visually check any changed documentation <building-the-docs>`
7. {ref}`Open a PR back to the main repository <open-a-pr>`
8. {ref}`Add a release note to your PR <adding-to-the-docs>`

## Code style

Expand Down
4 changes: 3 additions & 1 deletion docs/dev/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Sometimes these caches are not invalidated when you've updated the docs.
If docs are not updating the way you expect, first try "force reloading" your browser page – e.g. reload the page without using the cache.
Next, if problems persist, clear the sphinx cache (`hatch run docs:clean`) and try building them again.

(adding-to-the-docs)=

## Adding to the docs

For any user-visible changes, please make sure a note has been added to the release notes using [`hatch run towncrier:create`][towncrier create].
We recommend waiting on this until your PR is close to done since this can often causes merge conflicts.
When asked for “Issue number (`+` if none)”, enter the *PR number* instead.

Once you've added a new function to the documentation, you'll need to make sure there is a link somewhere in the documentation site pointing to it.
This should be added to `docs/api.md` under a relevant heading.
Expand Down
3 changes: 2 additions & 1 deletion docs/extensions/param_police.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def show_param_warnings(app, exception):
line,
)
if param_warnings:
raise RuntimeError("Encountered text parameter type. Use annotations.")
msg = "Encountered text parameter type. Use annotations."
raise RuntimeError(msg)


def setup(app: Sphinx):
Expand Down
8 changes: 4 additions & 4 deletions docs/release-notes/1.11.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
- {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 support for `median` as an aggregation function to {func}`~scanpy.get.aggregate`. 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`)
- Use upstreamed {class}`~sklearn.decomposition.PCA` implementation for {class}`~scipy.sparse.csr_array` and {class}`~scipy.sparse.csr_matrix` (see scikit-learn {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`)
- Add support for {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`)
- Run numba functions single-threaded when called from inside of a {class}`~multiprocessing.pool.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`)

Expand Down
1 change: 1 addition & 0 deletions docs/release-notes/3418.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix reference in {mod}`scanpy.pp` page {smaller}`D Kazemi`
1 change: 1 addition & 0 deletions docs/release-notes/3426.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix {func}`~scanpy.tl.rank_genes_groups` compatibility with data >10M cells {smaller}`P Angerer`
24 changes: 12 additions & 12 deletions hatch.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[envs.default]
installer = "uv"
features = ["dev"]
features = [ "dev" ]

[envs.docs]
features = ["doc"]
features = [ "doc" ]
scripts.build = "sphinx-build -M html docs docs/_build -W --keep-going {args}"
scripts.open = "python3 -m webbrowser -t docs/_build/html/index.html"
scripts.clean = "git clean -fdX -- {args:docs}"
Expand All @@ -14,23 +14,23 @@ scripts.build = "python3 ci/scripts/towncrier_automation.py {args}"
scripts.clean = "git restore --source=HEAD --staged --worktree -- docs/release-notes"

[envs.hatch-test]
default-args = []
features = ["test", "dask-ml"]
extra-dependencies = ["ipykernel"]
default-args = [ ]
features = [ "test", "dask-ml" ]
extra-dependencies = [ "ipykernel" ]
overrides.matrix.deps.env-vars = [
{ if = ["pre"], key = "UV_PRERELEASE", value = "allow" },
{ if = ["min"], key = "UV_CONSTRAINT", value = "ci/scanpy-min-deps.txt" },
{ if = [ "pre" ], key = "UV_PRERELEASE", value = "allow" },
{ 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 --all-extras -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" },
{ if = ["stable", "full", "pre"], value = "3.12" },
{ if = [ "min" ], value = "3.10" },
{ if = [ "stable", "full", "pre" ], value = "3.12" },
]
overrides.matrix.deps.features = [
{ if = ["full"], value = "test-full" },
{ if = [ "full" ], value = "test-full" },
]

[[envs.hatch-test.matrix]]
deps = ["stable", "full", "pre", "min"]
deps = [ "stable", "full", "pre", "min" ]
Loading

0 comments on commit 89c6c72

Please sign in to comment.