1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
|
[build-system]
build-backend = "hatchling.build"
requires = [ "hatchling", "hatch-vcs" ]
[project]
name = "anndata"
description = "Annotated data."
requires-python = ">=3.11"
license = "BSD-3-Clause"
authors = [
{ name = "Philipp Angerer" },
{ name = "Alex Wolf" },
{ name = "Isaac Virshup" },
{ name = "Sergei Rybakov" },
{ name = "Ilan Gold" },
]
maintainers = [
{ name = "Philipp Angerer", email = "philipp.angerer@helmholtz-munich.de" },
{ name = "Ilan Gold", email = "ilan.gold@helmholtz-munich.de" },
]
readme = "README.md"
classifiers = [
"Environment :: Console",
"Framework :: Jupyter",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Visualization",
]
dependencies = [
"pandas >=2.1.0, !=2.1.2",
"numpy>=1.26",
# https://github.com/scverse/anndata/issues/1434
"scipy >=1.12",
"h5py>=3.8",
"natsort",
"packaging>=24.2",
"array_api_compat>=1.7.1",
"legacy-api-wrap",
"zarr >=2.18.7, !=3.0.*",
]
dynamic = [ "version" ]
[project.urls]
Documentation = "https://anndata.readthedocs.io/"
Source = "https://github.com/scverse/anndata"
Home-page = "https://github.com/scverse/anndata"
[project.optional-dependencies]
dev = [
"anndata[dev-doc]",
]
doc = [
"sphinx>=8.2.1",
"sphinx-book-theme>=1.1.0",
"sphinx-autodoc-typehints>=2.2.0",
"sphinx-issues>=5.0.1",
"sphinx-copybutton",
"sphinx-toolbox>=3.8.0",
"sphinxext.opengraph",
"myst-nb",
"scanpydoc[theme,typehints] >=0.15.3",
"awkward>=2.3",
"IPython", # For syntax highlighting in notebooks
"myst_parser",
"sphinx_design>=0.5.0",
# for unreleased changes
"anndata[dev-doc,dask]",
]
dev-doc = [ "towncrier>=24.8.0" ] # release notes tool
test-min = [
"loompy>=3.0.5",
"pytest>=8.2,<8.3.4",
"pytest-cov", # only for VS Code
"pytest-randomly",
"pytest-memray",
"pytest-mock",
"pytest-xdist[psutil]",
"filelock",
"matplotlib",
"scikit-learn",
"openpyxl",
"joblib",
"boltons",
"scanpy>=1.10",
# TODO: Is 1.0dev1 a real pre-release? https://pypi.org/project/httpx/#history
"httpx<1.0", # For data downloading
"dask[distributed]",
"awkward>=2.3.2",
"pyarrow",
"anndata[dask]",
]
test = [ "anndata[test-min,lazy]" ]
gpu = [ "cupy" ]
cu12 = [ "cupy-cuda12x" ]
cu11 = [ "cupy-cuda11x" ]
# requests and aiohttp needed for zarr remote data
lazy = [ "xarray>=2025.06.1", "aiohttp", "requests", "anndata[dask]" ]
# https://github.com/dask/dask/issues/11290
# https://github.com/dask/dask/issues/11752
dask = [
"dask[array]>=2023.5.1,!=2024.8.*,!=2024.9.*,!=2025.2.*,!=2025.3.*,!=2025.4.*,!=2025.5.*,!=2025.6.*,!=2025.7.*,!=2025.8.*",
]
[tool.hatch.version]
source = "vcs"
raw-options.version_scheme = "release-branch-semver"
[tool.hatch.build.targets.wheel]
packages = [ "src/anndata", "src/testing" ]
[tool.coverage.run]
data_file = "test-data/raw-coverage"
source_pkgs = [ "anndata" ]
omit = [ "src/anndata/_version.py", "**/test_*.py" ]
concurrency = [ "multiprocessing" ]
parallel = true
[tool.coverage.xml]
output = "test-data/coverage.xml"
[tool.coverage.paths]
source = [ "./src", "**/site-packages" ]
[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
]
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
"--strict-markers",
"--doctest-modules",
"--pyargs",
"-ptesting.anndata._pytest",
]
filterwarnings = [
"ignore::anndata._warnings.OldFormatWarning",
"ignore::anndata._warnings.ExperimentalFeatureWarning",
"ignore:.*first_column_names:FutureWarning:scanpy", # scanpy 1.10.x
"ignore:Importing read_.* from `anndata` is deprecated:FutureWarning:scanpy",
"ignore:`__version__` is deprecated:FutureWarning:scanpy",
# https://github.com/matplotlib/matplotlib/pull/30589
"ignore:.*'(oneOf|parseString|resetCache|enablePackrat)'.*'(one_of|parse_string|reset_cache|enable_packrat)':DeprecationWarning:matplotlib",
]
# When `--strict-warnings` is used, all warnings are treated as errors, except those:
filterwarnings_when_strict = [
"default::anndata._warnings.ImplicitModificationWarning",
"default:Transforming to str index:UserWarning",
"default:(Observation|Variable) names are not unique. To make them unique:UserWarning",
"default::scipy.sparse.SparseEfficiencyWarning",
"default::dask.array.core.PerformanceWarning",
"default:anndata will no longer support zarr v2:DeprecationWarning",
"default:The codec `vlen-utf8:UserWarning",
"default:The dtype `StringDType():UserWarning",
"default:Consolidated metadata is:UserWarning",
"default:.*Structured:zarr.core.dtype.common.UnstableSpecificationWarning",
"default:.*FixedLengthUTF32:zarr.core.dtype.common.UnstableSpecificationWarning",
"default:Automatic shard shape inference is experimental",
]
python_files = "test_*.py"
testpaths = [
"anndata", # docstrings (module name due to --pyargs)
"./tests", # unit tests
"./ci/scripts", # CI script tests
"./docs/concatenation.rst", # further doctests
]
# For some reason this effects how logging is shown when tests are run
xfail_strict = true
markers = [
"gpu: mark test to run on GPU",
"zarr_io: mark tests that involve zarr io",
"dask_distributed: tests that need a distributed client with multiple processes",
]
[tool.ruff]
src = [ "src" ]
[tool.ruff.format]
preview = true
docstring-code-format = true
[tool.ruff.lint]
select = [
"B", # Likely bugs and design issues
"BLE", # Blind except
"C4", # Comprehensions
"E", # Error detected by Pycodestyle
"EM", # Traceback-friendly error messages
"F", # Errors detected by Pyflakes
"FBT", # Boolean positional arguments
"I", # isort
"ICN", # Follow import conventions
"ISC", # Implicit string concatenation
"PERF", # Performance
"PIE", # Syntax simplifications
"PTH", # Pathlib instead of os.path
"PT", # Pytest conventions
"PL", # Pylint
"PYI", # Typing
"RUF", # Unused noqa
"SIM", # Code simplifications
"TC", # manage type checking blocks
"TID", # Banned imports
"UP", # pyupgrade
"W", # Warning detected by Pycodestyle
]
external = [ "PLR0917" ] # preview rule
ignore = [
"C408", # dict() syntax is preferable for dicts used as kwargs
"E501", # line too long -> we accept long comment lines; formatter gets rid of long code lines
"E731", # Do not assign a lambda expression, use a def -> AnnData allows lambda expression assignments,
"E741", # allow I, O, l as variable names -> I is the identity matrix, i, j, k, l is reasonable indexing notation
"TID252", # We use relative imports from parent modules
"PLC0415", # We use a lot of non-top-level imports
"PLR2004", # “2” is often not too “magic” a number
"PLW2901", # Shadowing loop variables isn’t a big deal
]
allowed-confusables = [ "×", "’", "–", "α" ]
[tool.ruff.lint.per-file-ignores]
# E721 comparing types, but we specifically are checking that we aren't getting subtypes (views)
"tests/test_readwrite.py" = [ "E721" ]
# PLR0913, PLR0917: tests can use a lot of “arguments” that are actually fixtures
"tests/**/*.py" = [ "PLR0913", "PLR0917" ]
[tool.ruff.lint.isort]
known-first-party = [ "anndata" ]
required-imports = [ "from __future__ import annotations" ]
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = [ "slice" ]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"subprocess.call".msg = "Use `subprocess.run([…])` instead"
"subprocess.check_call".msg = "Use `subprocess.run([…], check=True)` instead"
"subprocess.check_output".msg = "Use `subprocess.run([…], check=True, capture_output=True)` instead"
"legacy_api_wrap.legacy_api".msg = "Use anndata.compat.old_positionals instead"
[tool.ruff.lint.flake8-type-checking]
exempt-modules = [ ]
strict = true
[tool.ruff.lint.pylint]
max-args = 7
max-positional-args = 5
[tool.codespell]
skip = ".git,*.pdf,*.svg"
ignore-words-list = "theis,coo,homogenous"
[tool.towncrier]
package = "anndata"
directory = "docs/release-notes"
filename = "docs/release-notes/{version}.md"
single_file = false
package_dir = "src"
issue_format = "{{pr}}`{issue}`"
title_format = "(v{version})=\n### {version} {{small}}`{project_date}`"
# Valid fragments should be a subset of conventional commit types (except for `breaking`):
# https://github.com/commitizen/conventional-commit-types/blob/master/index.json
# style, refactor, test, build, ci: should not go into changelog
fragment.feat.name = "Features"
fragment.fix.name = "Bug fixes"
fragment.docs.name = "Documentation"
fragment.perf.name = "Performance"
fragment.chore.name = "Miscellaneous changes"
fragment.revert.name = "Revert"
fragment.breaking.name = "Breaking changes" # add `!` to commit type (e.g. “feature!:”)
|