cellmapper 0.2.4__tar.gz → 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. {cellmapper-0.2.4 → cellmapper-0.2.6}/.cruft.json +3 -3
  2. {cellmapper-0.2.4 → cellmapper-0.2.6}/.github/ISSUE_TEMPLATE/bug_report.yml +1 -1
  3. {cellmapper-0.2.4 → cellmapper-0.2.6}/.github/ISSUE_TEMPLATE/feature_request.yml +1 -1
  4. cellmapper-0.2.6/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  5. cellmapper-0.2.6/.github/copilot-instructions.md +7 -0
  6. {cellmapper-0.2.4 → cellmapper-0.2.6}/.github/workflows/build.yaml +2 -4
  7. {cellmapper-0.2.4 → cellmapper-0.2.6}/.github/workflows/release.yaml +2 -4
  8. {cellmapper-0.2.4 → cellmapper-0.2.6}/.github/workflows/test.yaml +6 -5
  9. {cellmapper-0.2.4 → cellmapper-0.2.6}/.gitignore +4 -0
  10. {cellmapper-0.2.4 → cellmapper-0.2.6}/.pre-commit-config.yaml +3 -3
  11. cellmapper-0.2.6/.python-version +1 -0
  12. {cellmapper-0.2.4 → cellmapper-0.2.6}/.readthedocs.yaml +2 -1
  13. cellmapper-0.2.6/AGENTS.md +77 -0
  14. {cellmapper-0.2.4 → cellmapper-0.2.6}/CHANGELOG.md +34 -0
  15. cellmapper-0.2.6/CLAUDE.md +5 -0
  16. {cellmapper-0.2.4 → cellmapper-0.2.6}/PKG-INFO +11 -8
  17. {cellmapper-0.2.4 → cellmapper-0.2.6}/README.md +1 -1
  18. cellmapper-0.2.6/REVIEW_GUIDE.md +74 -0
  19. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/conf.py +8 -4
  20. cellmapper-0.2.6/docs/notebooks/tutorials/data_denoising.ipynb +924 -0
  21. cellmapper-0.2.6/docs/notebooks/tutorials/query_to_reference_mapping.ipynb +1030 -0
  22. cellmapper-0.2.6/docs/notebooks/tutorials/spatial_mapping.ipynb +923 -0
  23. cellmapper-0.2.6/docs/notebooks/tutorials/spatial_smoothing.ipynb +1216 -0
  24. {cellmapper-0.2.4 → cellmapper-0.2.6}/pyproject.toml +65 -44
  25. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/_docs.py +1 -1
  26. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/check.py +19 -3
  27. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/model/_knn_backend.py +45 -0
  28. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/model/cellmapper.py +25 -15
  29. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/model/evaluate.py +400 -31
  30. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/model/kernel.py +12 -7
  31. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/conftest.py +24 -2
  32. cellmapper-0.2.6/tests/model/test_evaluate.py +294 -0
  33. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/model/test_query_to_reference_mapping.py +1 -1
  34. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/model/test_self_mapping.py +21 -7
  35. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/test_check.py +16 -0
  36. cellmapper-0.2.4/.github/copilot-instructions.md +0 -196
  37. cellmapper-0.2.4/docs/notebooks/tutorials/data_denoising.ipynb +0 -813
  38. cellmapper-0.2.4/docs/notebooks/tutorials/query_to_reference_mapping.ipynb +0 -1029
  39. cellmapper-0.2.4/docs/notebooks/tutorials/spatial_mapping.ipynb +0 -926
  40. cellmapper-0.2.4/docs/notebooks/tutorials/spatial_smoothing.ipynb +0 -1228
  41. cellmapper-0.2.4/tests/model/test_evaluate.py +0 -55
  42. {cellmapper-0.2.4 → cellmapper-0.2.6}/.codecov.yaml +0 -0
  43. {cellmapper-0.2.4 → cellmapper-0.2.6}/.editorconfig +0 -0
  44. {cellmapper-0.2.4 → cellmapper-0.2.6}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  45. {cellmapper-0.2.4 → cellmapper-0.2.6}/.vscode/extensions.json +0 -0
  46. {cellmapper-0.2.4 → cellmapper-0.2.6}/.vscode/launch.json +0 -0
  47. {cellmapper-0.2.4 → cellmapper-0.2.6}/.vscode/settings.json +0 -0
  48. {cellmapper-0.2.4 → cellmapper-0.2.6}/LICENSE +0 -0
  49. {cellmapper-0.2.4 → cellmapper-0.2.6}/biome.jsonc +0 -0
  50. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/_static/.gitkeep +0 -0
  51. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/_static/css/custom.css +0 -0
  52. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/_static/images/cellmapper_logo_dark.svg +0 -0
  53. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/_static/images/cellmapper_logo_light.svg +0 -0
  54. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/_templates/.gitkeep +0 -0
  55. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/_templates/autosummary/class.rst +0 -0
  56. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/api.md +0 -0
  57. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/changelog.md +0 -0
  58. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/contributing.md +0 -0
  59. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/extensions/typed_returns.py +0 -0
  60. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/index.md +0 -0
  61. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/notebooks/tutorials/index.rst +0 -0
  62. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/references.bib +0 -0
  63. {cellmapper-0.2.4 → cellmapper-0.2.6}/docs/references.md +0 -0
  64. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/__init__.py +0 -0
  65. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/constants.py +0 -0
  66. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/logging.py +0 -0
  67. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/model/embedding.py +0 -0
  68. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/model/mapping_operator.py +0 -0
  69. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/model/neighbors.py +0 -0
  70. {cellmapper-0.2.4 → cellmapper-0.2.6}/src/cellmapper/utils.py +0 -0
  71. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/data/precomputed_leiden.csv +0 -0
  72. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/model/test_embedding.py +0 -0
  73. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/model/test_kernel.py +0 -0
  74. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/model/test_mapping_operator.py +0 -0
  75. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/model/test_neighbors.py +0 -0
  76. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/test_basic.py +0 -0
  77. {cellmapper-0.2.4 → cellmapper-0.2.6}/tests/test_utils.py +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "template": "https://github.com/scverse/cookiecutter-scverse",
3
- "commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec",
4
- "checkout": "v0.6.0",
3
+ "commit": "6ff5b92b5d44ea6d8a88e47538475718d467db95",
4
+ "checkout": "v0.7.0",
5
5
  "context": {
6
6
  "cookiecutter": {
7
7
  "project_name": "cellmapper",
@@ -36,7 +36,7 @@
36
36
  "trim_blocks": true
37
37
  },
38
38
  "_template": "https://github.com/scverse/cookiecutter-scverse",
39
- "_commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec"
39
+ "_commit": "6ff5b92b5d44ea6d8a88e47538475718d467db95"
40
40
  }
41
41
  },
42
42
  "directory": null
@@ -1,6 +1,6 @@
1
1
  name: Bug report
2
2
  description: Report something that is broken or incorrect
3
- labels: bug
3
+ type: Bug
4
4
  body:
5
5
  - type: markdown
6
6
  attributes:
@@ -1,6 +1,6 @@
1
1
  name: Feature request
2
2
  description: Propose a new feature for cellmapper
3
- labels: enhancement
3
+ type: Enhancement
4
4
  body:
5
5
  - type: textarea
6
6
  id: description
@@ -0,0 +1,24 @@
1
+ ## Summary
2
+
3
+ Describe the change in 2-5 sentences.
4
+
5
+ ## Behavior Or Invariants Changed
6
+
7
+ Call out any behavior changes and any repo invariants touched.
8
+ If none, say "None".
9
+
10
+ ## Tests Run
11
+
12
+ List the commands you ran and anything you intentionally did not run.
13
+
14
+ ## Reviewer Focus
15
+
16
+ Point reviewers to the highest-risk files, code paths, or assumptions.
17
+
18
+ ## Context
19
+
20
+ Add any domain context, dataset assumptions, or implementation background that is not obvious from the diff.
21
+
22
+ ## Open Questions Or Follow-Ups
23
+
24
+ List anything intentionally deferred, uncertain, or worth extra scrutiny.
@@ -0,0 +1,7 @@
1
+ # Copilot Instructions for CellMapper
2
+
3
+ Canonical repo guidance lives in:
4
+ - `AGENTS.md` — architecture, invariants, and validation commands
5
+ - `REVIEW_GUIDE.md` — PR review workflow, risk areas, and changed-path test lookup
6
+
7
+ If this file conflicts with those guides, the guides win.
@@ -19,14 +19,12 @@ jobs:
19
19
  package:
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
- - uses: actions/checkout@v4
22
+ - uses: actions/checkout@v5
23
23
  with:
24
24
  filter: blob:none
25
25
  fetch-depth: 0
26
26
  - name: Install uv
27
- uses: astral-sh/setup-uv@v5
28
- with:
29
- cache-dependency-glob: pyproject.toml
27
+ uses: astral-sh/setup-uv@v7
30
28
  - name: Build package
31
29
  run: uv build
32
30
  - name: Check package
@@ -20,14 +20,12 @@ jobs:
20
20
  permissions:
21
21
  id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
22
22
  steps:
23
- - uses: actions/checkout@v4
23
+ - uses: actions/checkout@v5
24
24
  with:
25
25
  filter: blob:none
26
26
  fetch-depth: 0
27
27
  - name: Install uv
28
- uses: astral-sh/setup-uv@v5
29
- with:
30
- cache-dependency-glob: pyproject.toml
28
+ uses: astral-sh/setup-uv@v7
31
29
  - name: Build package
32
30
  run: uv build
33
31
  - name: Publish package distributions to PyPI
@@ -28,12 +28,12 @@ jobs:
28
28
  outputs:
29
29
  envs: ${{ steps.get-envs.outputs.envs }}
30
30
  steps:
31
- - uses: actions/checkout@v4
31
+ - uses: actions/checkout@v5
32
32
  with:
33
33
  filter: blob:none
34
34
  fetch-depth: 0
35
35
  - name: Install uv
36
- uses: astral-sh/setup-uv@v5
36
+ uses: astral-sh/setup-uv@v7
37
37
  - name: Get test environments
38
38
  id: get-envs
39
39
  run: |
@@ -60,17 +60,18 @@ jobs:
60
60
 
61
61
  name: ${{ matrix.env.label }}
62
62
  runs-on: ${{ matrix.os }}
63
+ # Allow pre-release tests to fail without blocking the PR (dependency compatibility issues)
64
+ continue-on-error: ${{ contains(matrix.env.name, 'pre') }}
63
65
 
64
66
  steps:
65
- - uses: actions/checkout@v4
67
+ - uses: actions/checkout@v5
66
68
  with:
67
69
  filter: blob:none
68
70
  fetch-depth: 0
69
71
  - name: Install uv
70
- uses: astral-sh/setup-uv@v5
72
+ uses: astral-sh/setup-uv@v7
71
73
  with:
72
74
  python-version: ${{ matrix.env.python }}
73
- cache-dependency-glob: pyproject.toml
74
75
  - name: create hatch environment
75
76
  run: uvx hatch env create ${{ matrix.env.name }}
76
77
  - name: run tests using hatch
@@ -11,8 +11,12 @@ __pycache__/
11
11
  # Distribution / packaging
12
12
  /dist/
13
13
 
14
+ # Lock files (library, not application)
15
+ uv.lock
16
+
14
17
  # Tests and coverage
15
18
  /data/
19
+ /tests/data/scanpy_cache/
16
20
  /node_modules/
17
21
  /.coverage*
18
22
 
@@ -7,16 +7,16 @@ default_stages:
7
7
  minimum_pre_commit_version: 2.16.0
8
8
  repos:
9
9
  - repo: https://github.com/biomejs/pre-commit
10
- rev: v2.2.6
10
+ rev: v2.4.16
11
11
  hooks:
12
12
  - id: biome-format
13
13
  exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
14
14
  - repo: https://github.com/tox-dev/pyproject-fmt
15
- rev: v2.11.0
15
+ rev: v2.23.0
16
16
  hooks:
17
17
  - id: pyproject-fmt
18
18
  - repo: https://github.com/astral-sh/ruff-pre-commit
19
- rev: v0.14.1
19
+ rev: v0.15.16
20
20
  hooks:
21
21
  - id: ruff-check
22
22
  types_or: [python, pyi, jupyter]
@@ -0,0 +1 @@
1
+ 3.13
@@ -3,7 +3,8 @@ version: 2
3
3
  build:
4
4
  os: ubuntu-24.04
5
5
  tools:
6
- python: "3.12"
6
+ python: "3.13"
7
+ nodejs: latest
7
8
  jobs:
8
9
  create_environment:
9
10
  - asdf plugin add uv
@@ -0,0 +1,77 @@
1
+ # AGENTS.md — CellMapper
2
+
3
+ CellMapper is a Python package for k-NN-based mapping of cells across
4
+ representations to transfer labels, embeddings, and expression values. It works
5
+ for millions of cells, on CPU and GPU, across molecular modalities, and between
6
+ spatial and non-spatial data. The core idea is to separate the method (k-NN
7
+ graph + kernel → mapping matrix) from the application (transfer across arbitrary
8
+ representations).
9
+ Key frameworks: AnnData/Scanpy, numpy/scipy, scikit-learn, pynndescent, faiss,
10
+ RAPIDS cuML.
11
+
12
+ ## Trust Order
13
+
14
+ When sources disagree:
15
+ 1. PR description and changed code
16
+ 2. This file (`AGENTS.md`)
17
+ 3. `REVIEW_GUIDE.md`
18
+ 4. Tests and fixtures
19
+ 5. Public docs in `docs/` and `README.md`
20
+
21
+ Every fact should have one owner. This file owns invariants and the reference
22
+ table below — everything else is delegated.
23
+
24
+ ## Where To Find What
25
+
26
+ | Topic | Source of truth |
27
+ |-------|----------------|
28
+ | User-facing overview, use cases, quickstart | `README.md` |
29
+ | Public API reference | `docs/api.md` and autosummary under `docs/generated/` |
30
+ | Tutorials (query→reference, spatial mapping, spatial smoothing, data denoising) | `docs/notebooks/tutorials/` |
31
+ | Contributor setup, environments, docs build | `docs/contributing.md` |
32
+ | Release notes | `docs/changelog.md` |
33
+ | PR review workflow and risk areas | `REVIEW_GUIDE.md` |
34
+ | Test fixtures | `tests/conftest.py`, `tests/data/` |
35
+ | Kernel taxonomy and tunable thresholds (sklearn warning cutoff, spectral threshold) | `src/cellmapper/constants.py` |
36
+ | Optional-dependency gating | `src/cellmapper/check.py` |
37
+ | Method-level behavior (parameters, return shapes) | docstrings in `src/cellmapper/model/` |
38
+
39
+ ## Review Guidelines
40
+
41
+ For GitHub PR reviews, use `REVIEW_GUIDE.md` as the canonical review workflow and
42
+ source of review-specific risk areas, testing checks, and documentation-impact checks.
43
+ This file only owns the project invariants and source-of-truth map below.
44
+
45
+ ## Critical Invariants
46
+
47
+ - **Self-mapping mode** activates when `reference is None` **or** `reference is query` (object identity). See `CellMapper.__init__` in `src/cellmapper/model/cellmapper.py`.
48
+ - **Reference is read-only.** `.map()` never mutates the reference AnnData. `query` is mutated in place for `map_obs` / `map_obsm`. Expression transfer produces a separate `query_imputed` AnnData object, not a view.
49
+ - **Output key naming** follows `{key}{prediction_postfix}` and `{key}{confidence_postfix}` in `query.obs` / `query.obsm`. Postfixes are user-controllable on the per-method entrypoints (`map_obs`, `map_obsm`); `.map()` also exposes `prediction_postfix`.
50
+ - **`.map()` auto-chains** `compute_neighbors` → `compute_mapping_matrix` → `map_obs/obsm/layers` based on missing state. Callers that use these methods directly must respect that ordering.
51
+ - **Mapping matrix is row-stochastic and float32.** Sparse inputs are stored as `scipy.sparse.csr_matrix`; dense inputs stay dense. Zero-neighbor rows are left as-is. See `MappingOperator._validate_and_normalize_mapping_matrix`.
52
+ - **Matrix powers `t > 1` are self-mapping-only** (`MappingOperator._validate_power` raises otherwise).
53
+ - **Optional k-NN backends fail fast.** `check.check_deps()` is called at backend construction with clear install hints — no silent fallback. Supported backends: `sklearn`, `pynndescent`, `faiss-cpu`, `faiss-gpu`, `rapids`.
54
+ - **Kernel taxonomy lives in `constants.py`** (`JACCARD_BASED_KERNELS`, `CONNECTIVITY_BASED_KERNELS`, `SELF_MAPPING_ONLY_KERNELS`). Kernels in `SELF_MAPPING_ONLY_KERNELS` require a square neighbor matrix.
55
+ - **`Neighbors` strips self-edges** from storage for square matrices; `n_neighbors` counts non-self neighbors.
56
+ - **`query_imputed` is always assembled via `utils.create_imputed_anndata`**. Setter accepts `AnnData | ndarray | csr_matrix | DataFrame | None`; result has `obs`/`obsm` from query and `var`/`varm` from reference.
57
+ - **Public API surface = `__init__.py` `__all__`**: `CellMapper`, `Kernel`, `Neighbors`, `logger`. `EvaluationMixin` and `EmbeddingMixin` are internal. Do not re-export helpers from the top-level package.
58
+ - **Tests mirror source layout.** `src/cellmapper/X.py` → `tests/test_X.py`; `src/cellmapper/model/X.py` → `tests/model/test_X.py`.
59
+
60
+ ## Development Commands
61
+
62
+ Python 3.12 and 3.14 (see the `hatch-test` matrix in `pyproject.toml`).
63
+
64
+ ```bash
65
+ hatch test # run tests (highest Python)
66
+ hatch test --all # full matrix
67
+ hatch run docs:build # build Sphinx docs
68
+ pre-commit run --all-files # lint and format
69
+ ```
70
+
71
+ Focused runs (with `uv`):
72
+
73
+ ```bash
74
+ uv run pytest tests/model
75
+ uv run pytest tests/model/test_mapping_operator.py
76
+ uv run pytest tests/test_utils.py
77
+ ```
@@ -10,6 +10,40 @@ and this project adheres to [Semantic Versioning][].
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ### Changed
14
+ - Dropped Python 3.11 support; the minimum supported version is now Python 3.12, aligning with `cellrank` (≥2.1 requires Python ≥3.12) and unpinning the `tutorials` extra from the old `cellrank` 2.0.7 {pr}`81`
15
+ - The `gpcca-fast` dependency group now delegates `petsc4py`/`slepc4py` to `cellrank[petsc]>=2.3.1` (mpi4py-free) instead of hardcoding them, keeping only an explicit `slepc` to work around slepc4py's missing runtime metadata {pr}`82`
16
+
17
+ ### Fixed
18
+ - Fixed intermittent `OSError: Can't synchronously read data (filter returned failure during read)` when running the test suite under `pytest -n auto`, caused by xdist workers racing on scanpy's shared `pbmc3k_raw.h5ad` dataset cache. Each worker now uses its own cache directory.
19
+
20
+ ## [v0.2.5]
21
+
22
+ ### Added
23
+ - Added `batch_size` parameter to `Kernel.compute_neighbors()` for backend-agnostic batching {pr}`60`
24
+ - Added `subset` parameter to `plot_confusion_matrix()` for filtering cells {pr}`60`
25
+ - Added Python 3.14 support {pr}`62`
26
+
27
+ ### Changed
28
+ - Default postfixes now include underscore: `"_pred"` and `"_conf"` instead of `"pred"` and `"conf"` {pr}`60`
29
+ - Switched from MathJax to KaTeX for documentation math rendering {pr}`61`
30
+ - Updated GitHub Actions to latest versions (checkout v5, setup-uv v7) {pr}`61`
31
+ - Updated test matrix to Python 3.11/3.14 {pr}`62`
32
+
33
+ ### Fixed
34
+ - Fixed `PackageNotFoundError` when checking rapids availability in conda environments {pr}`60`
35
+ - Fixed stale k-NN state when `compute_neighbors()` fails {pr}`60`
36
+ - Fixed `plot_confusion_matrix()` handling of NaN values in both y_true and y_pred {pr}`60`
37
+ - Fixed `plot_confusion_matrix()` handling of mismatched category sets {pr}`60`
38
+ - Fixed `plot_confusion_matrix()` handling of float categories {pr}`60`
39
+ - Fixed `importlib.resources.files()` compatibility with Python 3.14 {pr}`62`
40
+
41
+ ## [v0.2.4]
42
+
43
+ ### Changed
44
+ - Deprecated Python 3.10 support {pr}`55`
45
+ - Updated to cookiecutter-scverse template v0.6.0 {pr}`54`
46
+
13
47
  ## [v0.2.3]
14
48
 
15
49
  ### Changed
@@ -0,0 +1,5 @@
1
+ # CellMapper Agent Entry Point
2
+
3
+ @AGENTS.md
4
+
5
+ Use `REVIEW_GUIDE.md` for automated PR review workflow, risk areas, and changed-path test lookup.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cellmapper
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: k-NN-based mapping of cells across representations
5
5
  Project-URL: Documentation, https://cellmapper.readthedocs.io/
6
6
  Project-URL: Homepage, https://github.com/quadbio/cellmapper
@@ -30,11 +30,10 @@ License: MIT License
30
30
  SOFTWARE.
31
31
  License-File: LICENSE
32
32
  Classifier: Programming Language :: Python :: 3 :: Only
33
- Classifier: Programming Language :: Python :: 3.11
34
33
  Classifier: Programming Language :: Python :: 3.12
35
34
  Classifier: Programming Language :: Python :: 3.13
36
35
  Classifier: Programming Language :: Python :: 3.14
37
- Requires-Python: >=3.11
36
+ Requires-Python: >=3.12
38
37
  Requires-Dist: anndata>=0.11
39
38
  Requires-Dist: docrep
40
39
  Requires-Dist: numpy
@@ -49,9 +48,10 @@ Provides-Extra: dev
49
48
  Requires-Dist: pre-commit; extra == 'dev'
50
49
  Requires-Dist: twine>=4.0.2; extra == 'dev'
51
50
  Provides-Extra: doc
52
- Requires-Dist: docutils!=0.18.*,!=0.19.*,>=0.8; extra == 'doc'
51
+ Requires-Dist: docutils!=0.18.*,!=0.19.*,<0.22,>=0.8; extra == 'doc'
53
52
  Requires-Dist: ipykernel; extra == 'doc'
54
53
  Requires-Dist: ipython; extra == 'doc'
54
+ Requires-Dist: ipywidgets; extra == 'doc'
55
55
  Requires-Dist: myst-nb>=1.1; extra == 'doc'
56
56
  Requires-Dist: pandas; extra == 'doc'
57
57
  Requires-Dist: setuptools; extra == 'doc'
@@ -61,22 +61,25 @@ Requires-Dist: sphinx-copybutton; extra == 'doc'
61
61
  Requires-Dist: sphinx-tabs; extra == 'doc'
62
62
  Requires-Dist: sphinx>=8.1; extra == 'doc'
63
63
  Requires-Dist: sphinxcontrib-bibtex>=1; extra == 'doc'
64
+ Requires-Dist: sphinxcontrib-katex; extra == 'doc'
64
65
  Requires-Dist: sphinxext-opengraph; extra == 'doc'
65
66
  Provides-Extra: test
66
67
  Requires-Dist: coverage>=7.10; extra == 'test'
67
68
  Requires-Dist: faiss-cpu; extra == 'test'
68
69
  Requires-Dist: pytest; extra == 'test'
69
70
  Requires-Dist: pytest-cov; extra == 'test'
70
- Requires-Dist: squidpy>=1.6; extra == 'test'
71
+ Requires-Dist: pytest-mock; extra == 'test'
72
+ Requires-Dist: squidpy>=1.8; extra == 'test'
71
73
  Provides-Extra: tutorials
74
+ Requires-Dist: cellrank>=2; extra == 'tutorials'
72
75
  Requires-Dist: harmony-pytorch; extra == 'tutorials'
73
76
  Requires-Dist: igraph; extra == 'tutorials'
74
77
  Requires-Dist: netgraph; extra == 'tutorials'
75
78
  Requires-Dist: python-louvain; extra == 'tutorials'
76
79
  Requires-Dist: scvi-tools>=1.3; extra == 'tutorials'
77
80
  Requires-Dist: seaborn; extra == 'tutorials'
78
- Requires-Dist: sopa>=2; extra == 'tutorials'
79
- Requires-Dist: squidpy>=1.6; extra == 'tutorials'
81
+ Requires-Dist: sopa>=2.2; extra == 'tutorials'
82
+ Requires-Dist: squidpy>=1.8; extra == 'tutorials'
80
83
  Description-Content-Type: text/markdown
81
84
 
82
85
  # CellMapper
@@ -113,7 +116,7 @@ The core idea of `CellMapper` is to separate the method (k-NN graph with some ke
113
116
 
114
117
  ## 📦 Installation
115
118
 
116
- You need to have 🐍 Python 3.11 or newer installed on your system.
119
+ You need to have 🐍 Python 3.12 or newer installed on your system.
117
120
  If you don't have Python installed, we recommend installing [uv][].
118
121
 
119
122
  There are two alternative options to install ``cellmapper``:
@@ -32,7 +32,7 @@ The core idea of `CellMapper` is to separate the method (k-NN graph with some ke
32
32
 
33
33
  ## 📦 Installation
34
34
 
35
- You need to have 🐍 Python 3.11 or newer installed on your system.
35
+ You need to have 🐍 Python 3.12 or newer installed on your system.
36
36
  If you don't have Python installed, we recommend installing [uv][].
37
37
 
38
38
  There are two alternative options to install ``cellmapper``:
@@ -0,0 +1,74 @@
1
+ # CellMapper Review Guide
2
+
3
+ Agent-neutral PR review playbook. Written for **review agents running on GitHub** — use the imperative voice.
4
+
5
+ **Scope: review only.** Produce comments and suggestions. Do **not** push commits, modify files, or apply fixes. Flag issues and suggest diffs in comments; leave the edits to the author.
6
+
7
+ Architecture, invariants, and commands live in `AGENTS.md`. Do not restate them here — link.
8
+
9
+ ## Workflow
10
+
11
+ 1. Read the PR body.
12
+ 2. Check CI (`gh pr checks <num>`, `gh run view <run-id> --log-failed`) and investigate failures before commenting.
13
+ 3. Map changed paths to tests (see below) and check whether the change touches an invariant from `AGENTS.md`.
14
+ 4. Prioritize behavioral regressions, numerical correctness, and public-contract changes over style.
15
+
16
+ ## High-Risk Areas
17
+
18
+ Pointers only — see `AGENTS.md` for the actual invariants.
19
+
20
+ - **Mapping-matrix construction** (`model/mapping_operator.py`): normalization, dtype, sparsity handling. Silent shifts possible without test failures.
21
+ - **Matrix powers / diffusion** (`model/mapping_operator.py`, `_validate_power`, `_apply_iterative`, `_apply_spectral`): self-mapping gate, iterative-vs-spectral behavior.
22
+ - **Self-mapping detection** (`model/cellmapper.py::CellMapper.__init__`): identity check drives all downstream mode-dependent logic.
23
+ - **Kernel taxonomy** (`constants.py`, `model/kernel.py`, `model/neighbors.py`): new kernels must land in the right set in `constants.py`.
24
+ - **k-NN backend gating** (`model/_knn_backend.py`, `check.py`): optional deps must route through `check.check_deps()`.
25
+ - **AnnData output contract** (`model/cellmapper.py::map_obs / map_obsm / map_layers`): key naming, what gets written where, `query_imputed` construction via `utils.create_imputed_anndata`.
26
+ - **Public API surface** (`src/cellmapper/__init__.py`): new re-exports commit the project to an API.
27
+
28
+ ## Changed-Path Test Lookup
29
+
30
+ Tests mirror the source tree.
31
+
32
+ | Changed path | Primary tests |
33
+ |--------------|---------------|
34
+ | `src/cellmapper/model/cellmapper.py` | `tests/model/test_query_to_reference_mapping.py`, `tests/model/test_self_mapping.py` |
35
+ | `src/cellmapper/model/kernel.py` | `tests/model/test_kernel.py` |
36
+ | `src/cellmapper/model/mapping_operator.py` | `tests/model/test_mapping_operator.py` |
37
+ | `src/cellmapper/model/neighbors.py` | `tests/model/test_neighbors.py` |
38
+ | `src/cellmapper/model/embedding.py` | `tests/model/test_embedding.py` |
39
+ | `src/cellmapper/model/evaluate.py` | `tests/model/test_evaluate.py` |
40
+ | `src/cellmapper/model/_knn_backend.py` | `tests/model/test_neighbors.py`, `tests/model/test_kernel.py` |
41
+ | `src/cellmapper/check.py` | `tests/test_check.py` |
42
+ | `src/cellmapper/utils.py` | `tests/test_utils.py` |
43
+ | End-to-end behavioral change | also `tests/test_basic.py` |
44
+ | Fixture changes | `tests/conftest.py`, `tests/data/` |
45
+
46
+ ## Testing
47
+
48
+ - **New code** should be covered. Reuse fixtures from `tests/conftest.py`; prefer `pytest.mark.parametrize`; favor few meaningful tests over many redundant ones.
49
+ - **Failing CI** is not to be waved through. Distinguish critical regressions from flakes; escalate critical ones.
50
+ - **Modified tests** — scrutinize *how*. Relaxed tolerances, removed assertions, deleted cases, or loosened matrices are red flags. Require explicit justification in the PR body.
51
+
52
+ ## Documentation Impact
53
+
54
+ Behavior or API changes often touch docs in multiple places. Point at the **owning file** (see the `AGENTS.md` "Where To Find What" table) — don't duplicate content in the review.
55
+
56
+ - Public symbol / API changes → `docs/api.md`, autosummary, `README.md` quickstart, source docstrings.
57
+ - Contributor workflow or env changes → `docs/contributing.md`.
58
+ - Tutorials under `docs/notebooks/tutorials/` → flag stale imports, outputs, or API usage.
59
+ - Invariants / commands → `AGENTS.md`.
60
+ - Review workflow / risk areas / test lookup → this file.
61
+ - `CLAUDE.md` and `.github/copilot-instructions.md` should stay thin pointers — flag any PR that re-adds content here.
62
+
63
+ ## Checklist
64
+
65
+ - Invariants in `AGENTS.md` preserved?
66
+ - CI green (or failures investigated)?
67
+ - Test coverage adequate and not silently weakened?
68
+ - Public contracts (AnnData output, mapping matrix format, public API surface) unchanged — or explicitly called out in the PR body?
69
+ - Affected human- and agent-facing docs updated?
70
+ - PR scope tight, no unrelated bundling?
71
+
72
+ ## PR Metadata
73
+
74
+ This repo uses `.github/PULL_REQUEST_TEMPLATE.md`. Treat its sections as the preferred summary surface.
@@ -5,11 +5,14 @@
5
5
  # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
6
 
7
7
  # -- Path setup --------------------------------------------------------------
8
+ import shutil
8
9
  import sys
9
10
  from datetime import datetime
10
11
  from importlib.metadata import metadata
11
12
  from pathlib import Path
12
13
 
14
+ from sphinxcontrib import katex
15
+
13
16
  HERE = Path(__file__).parent
14
17
  sys.path.insert(0, str(HERE / "extensions"))
15
18
 
@@ -19,7 +22,7 @@ sys.path.insert(0, str(HERE / "extensions"))
19
22
  # NOTE: If you installed your project in editable mode, this might be stale.
20
23
  # If this is the case, reinstall it to refresh the metadata
21
24
  info = metadata("cellmapper")
22
- project_name = info["Name"]
25
+ project = info["Name"]
23
26
  author = info["Author"]
24
27
  copyright = f"{datetime.now():%Y}, {author}."
25
28
  version = info["Version"]
@@ -37,7 +40,7 @@ needs_sphinx = "4.0"
37
40
  html_context = {
38
41
  "display_github": True, # Integrate GitHub
39
42
  "github_user": "quadbio",
40
- "github_repo": project_name,
43
+ "github_repo": project,
41
44
  "github_version": "main",
42
45
  "conf_py_path": "/docs/",
43
46
  }
@@ -54,9 +57,9 @@ extensions = [
54
57
  "sphinx.ext.autosummary",
55
58
  "sphinx.ext.napoleon",
56
59
  "sphinxcontrib.bibtex",
60
+ "sphinxcontrib.katex",
57
61
  "sphinx_autodoc_typehints",
58
62
  "sphinx_tabs.tabs",
59
- "sphinx.ext.mathjax",
60
63
  "IPython.sphinxext.ipython_console_highlighting",
61
64
  "sphinxext.opengraph",
62
65
  *[p.stem for p in (HERE / "extensions").glob("*.py")],
@@ -121,7 +124,7 @@ html_theme = "sphinx_book_theme"
121
124
  html_static_path = ["_static"]
122
125
  html_css_files = ["css/custom.css"]
123
126
 
124
- html_title = project_name
127
+ html_title = project
125
128
 
126
129
  html_theme_options = {
127
130
  "repository_url": repository_url,
@@ -135,6 +138,7 @@ html_theme_options = {
135
138
  }
136
139
 
137
140
  pygments_style = "default"
141
+ katex_prerender = shutil.which(katex.NODEJS_BINARY) is not None
138
142
 
139
143
  nitpick_ignore = [
140
144
  # If building the documentation fails because of a missing link that is outside your control,